c++ - boost::circular_buffer<unique_ptr<T>>::set_capacity() fails to build -


i'm trying use boost::circular_buffer in code this:

class eventregistry { public:     eventregistry()     {         pendingevents_.set_capacity(max_pending_events);     }  private:     boost::circular_buffer<boost::movelib::unique_ptr<eventdata>> pendingevents_; } 

however, i'm getting build failure (excerpted):

... boost/build/binaries/include/boost/circular_buffer/details.hpp:470:12: note: in instantiation of function template specialization 'boost::cb_details::uninitialized_move_if_noexcept_impl<boost::cb_details::iterator<boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >, boost::cb_details::nonconst_traits<boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > > > >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > *, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >' requested here     return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());            ^ boost/build/binaries/include/boost/circular_buffer/base.hpp:955:37: note: in instantiation of function template specialization 'boost::cb_details::uninitialized_move_if_noexcept<boost::cb_details::iterator<boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >, boost::cb_details::nonconst_traits<boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > > > >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > *, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >' requested here             reset(buff, cb_details::uninitialized_move_if_noexcept(e - (std::min)(new_capacity, size()),                                     ^ events/event_registry.cc:22:18: note: in instantiation of member function 'boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >::rset_capacity' requested here   pendingevents_.rset_capacity(max_pending_events); ... 

however, if use initializer in constructor:

eventregistry()   : pendingevents_(max_pending_events) 

then compiles fine. clues?

update: here's full output (sorry length)

boost/build/binaries/include/boost/container/allocator_traits.hpp:408:51: error: no matching constructor initialization of 'boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >'       {  ::new((void*)p, boost_container_new_t()) t(::boost::forward<args>(args)...); }                                                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ boost/build/binaries/include/boost/container/allocator_traits.hpp:353:28: note: in instantiation of function template specialization 'boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >::priv_construct<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > >' requested here          allocator_traits::priv_construct(flag, a, p, ::boost::forward<args>(args)...);                            ^ boost/build/binaries/include/boost/circular_buffer/details.hpp:439:56: note: in instantiation of function template specialization 'boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >::construct<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > >' requested here             boost::container::allocator_traits<alloc>::construct(a, boost::addressof(*dest), *first);                                                        ^ boost/build/binaries/include/boost/circular_buffer/details.hpp:460:12: note: in instantiation of function template specialization 'boost::cb_details::uninitialized_copy<boost::cb_details::iterator<boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >, boost::cb_details::nonconst_traits<boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > > > >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > *, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >' requested here     return uninitialized_copy(first, last, dest, a);            ^ boost/build/binaries/include/boost/circular_buffer/details.hpp:470:12: note: in instantiation of function template specialization 'boost::cb_details::uninitialized_move_if_noexcept_impl<boost::cb_details::iterator<boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >, boost::cb_details::nonconst_traits<boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > > > >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > *, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >' requested here     return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());            ^ boost/build/binaries/include/boost/circular_buffer/base.hpp:880:29: note: in instantiation of function template specialization 'boost::cb_details::uninitialized_move_if_noexcept<boost::cb_details::iterator<boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >, boost::cb_details::nonconst_traits<boost::container::allocator_traits<std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > > > >, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > *, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >' requested here                 cb_details::uninitialized_move_if_noexcept(b, b + (std::min)(new_capacity, size()), buff, m_alloc),                             ^ .../events/event_registry.cc:22:18: note: in instantiation of member function 'boost::circular_buffer<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, std::allocator<boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> > > >::set_capacity' requested here   pendingevents_.set_capacity(max_events_per_timewindow);                  ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:360:35: note: candidate constructor not viable: 1st argument ('const boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >') lose const qualifier    boost_movable_but_not_copyable(unique_ptr)                                   ^ boost/build/binaries/include/boost/move/core.hpp:242:46: note: expanded macro 'boost_movable_but_not_copyable'       boost_move_impl_no_copy_ctor_or_assign(type)\                                              ^ boost/build/binaries/include/boost/move/core.hpp:35:7: note: expanded macro 'boost_move_impl_no_copy_ctor_or_assign'       type(type &);\       ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:401:20: note: candidate constructor not viable: no known conversion 'const boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >' 'bmupd::nullptr_type' (aka 'int (boost::move_upd::bool_conversion::*)()') 1st argument    boost_constexpr unique_ptr(boost_move_doc0ptr(bmupd::nullptr_type)) boost_noexcept                    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:527:4: note: candidate constructor not viable: no known conversion 'const boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >' '::boost::rv<unique_ptr<eventdata, default_delete<eventdata> > > &' 1st argument    unique_ptr(boost_rv_ref(unique_ptr) u) boost_noexcept    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:424:13: note: candidate template ignored: substitution failure [with pointer = boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >]: no type named 'type' in 'boost::move_upd::enable_up_ptr<appd::agent::eventdata, boost::movelib::unique_ptr<appd::agent::eventdata, boost::movelib::default_delete<appd::agent::eventdata> >, appd::agent::eventdata *, boost::move_upmu::nat>'    explicit unique_ptr(pointer p             ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:462:4: note: candidate constructor template not viable: requires @ least 2 arguments, 1 provided    unique_ptr(pointer p, boost_move_seedoc(deleter_arg_type1) d1    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:500:4: note: candidate constructor template not viable: requires @ least 2 arguments, 1 provided    unique_ptr(pointer p, boost_move_seedoc(deleter_arg_type2) d2    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:547:4: note: candidate template ignored: instantiation take own class type value    unique_ptr( boost_rv_ref_beg_if_cxx11 unique_ptr<u, e> boost_rv_ref_end_if_cxx11 u    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:390:20: note: candidate constructor not viable: requires 0 arguments, 1 provided    boost_constexpr unique_ptr() boost_noexcept                    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:475:4: note: candidate constructor not viable: requires 2 arguments, 1 provided    unique_ptr(boost_move_doc0ptr(bmupd::nullptr_type), boost_move_seedoc(deleter_arg_type1) d1) boost_noexcept    ^ boost/build/binaries/include/boost/move/unique_ptr.hpp:513:4: note: candidate constructor not viable: requires 2 arguments, 1 provided    unique_ptr(boost_move_doc0ptr(bmupd::nullptr_type), boost_move_seedoc(deleter_arg_type2) d2) boost_noexcept    ^ 1 error generated. 

the following compiles fine...

#include <boost/circular_buffer.hpp> #include <boost/move/unique_ptr.hpp>  class eventregistry { public:     eventregistry()     {         pendingevents_.set_capacity(10);     }  private:     boost::circular_buffer<boost::movelib::unique_ptr<int>> pendingevents_; };  int main() {     return 0; } 

note i've placed int have eventdata. you're problem related eventdata.

(i don't have enough points, comment...)

edit: oh , check kind of constructors eventdata has! have default constructor??


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -