Why is the copy constructor used here?

I have the following code snippet:

template <class Callback>
void CreateRouteIteratorAndStore(ChordID searchValue,
                                 const Fingertable &initialTable,
                                 Client &client,
                                 Callback &&callback) {
    RouteIteratorSpecialization<RouteIteratorType::Online_StoreLookup>
        implementation{client, initialTable};
    new RouteIterator<Callback, decltype(implementation)>(
        std::move(implementation), std::move(searchValue), initialTable, client,
        std::forward<Callback>(callback));
}

The RouteIterator constructor looks like this:

template <class Callback, class Impl>
RouteIterator<Callback, Impl>::RouteIterator(Impl impl,
                                             ChordID searchValue,
                                             const Fingertable &initialTable,
                                             Client &client,
                                             Callback &&callback)
    : impl_(std::move(impl)), ... {}

I get an error message:

Invoking an implicitly deleted copy of the constructor 'Nisan :: RouteIteratorSpecialization

On the site call the constructor RouteIterator. RouteIteratorSpecialization has a move constructor, but not a copy constructor. It is expected, but what I am not getting is the reason that the copy is called and not the move constructor.

Please do not worry about the new. This lifetime is a mess that I need to fix at some point.

: RouteIteratorSpecialization<RouteIteratorType::Online_StoreLookup> noexcept. . , .

+4

Source: https://habr.com/ru/post/1673581/


All Articles