I am getting this weird error with a vector that I have never gotten before. The vector somehow seems to require a copy constructor for the items that are in it. The compiler errors are pasted below.
/Applications/http://ift.tt/2e0surO: error: call to implicitly-deleted copy constructor of 'Something'
::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/http://ift.tt/2eVk4iY: note: in instantiation of function template specialization 'std::__1::allocator<Something>::construct<Something, Something &>' requested here
{__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
^
/Applications/http://ift.tt/2e0t9cB: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<Something> >::__construct<Something, Something
&>' requested here
{__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
^
/Applications/http://ift.tt/2eVhCcl: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<Something> >::construct<Something, Something &>'
requested here
construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1);
^
/Applications/http://ift.tt/2e0xzQX: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<Something>
>::__construct_range_forward<Something *, Something *>' requested here
__alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_);
^
/Applications/http://ift.tt/2eVldab: note: in instantiation of function template specialization 'std::__1::vector<Something, std::__1::allocator<Something> >::__construct_at_end<Something *>'
requested here
__construct_at_end(__x.__begin_, __x.__end_, __n);
^
./WrapperClass.hpp:29:7: note: in instantiation of member function 'std::__1::vector<Something, std::__1::allocator<Something> >::vector' requested here
class WrapperClass {
^
./Something.hpp:44:5: note: copy constructor is implicitly deleted because 'Something' has a user-declared move constructor
Something(Something&&) noexcept = default;
I was under the impression that a vector only requires a copy constructor when the move constructor of the type it contains is not noexcept
, I have marked the type to be noexcept
but I still get the error.
Does this have something to do with using the <algorithm>
header with a vector? What are the conditions for a vector to require a move constructor?
Thanks,
Aucun commentaire:
Enregistrer un commentaire