Compile problems with instrusive::slist::push_back
From this piece of code ---------------------------------------- #include <boost/intrusive/slist.hpp> class Node : public boost::intrusive::slist_base_hook<> { public: Node(int x) : x(x) {} int x; }; typedef boost::intrusive::slist<Node> List; int main(int argc,char *argv[]) { List list; Node n1(1234); Node n2(5678); list.push_front(n1); list.push_back(n2); return 0; } ------------------------------------------ I get the following error: johannes@pc1:~/Progs/Components/Boost> g++ IntrusiveTest1.C -Iboost_1_39_0 boost_1_39_0/boost/intrusive/slist.hpp: In member function 'void boost::intrusive::slist_impl<Config>::push_back(typename std::iterator_traits<typename boost::intrusive::detail::eval_if_c<boost::intrusive::slist_impl<Config>::external_value_traits, boost::intrusive::detail::eval_value_traits<typename Config::value_traits>, boost::intrusive::detail::identity<typename Config::value_traits> >::type::pointer>::reference) [with Config = boost::intrusive::slistopt<boost::intrusive::detail::base_hook_traits<Node, boost::intrusive::slist_node_traits<void*>, safe_link, boost::intrusive::default_tag, 2>, long unsigned int, true, false, false>]': IntrusiveTest1.C:16: instantiated from here false>boost_1_39_0/boost/intrusive/slist.hpp:382: error: invalid false>application of 'sizeof' to incomplete type false>'boost::STATIC_ASSERTION_FAILURE<false>' IntrusiveTest1.C:16: false>instantiated from here false>boost_1_39_0/boost/intrusive/slist.hpp:382: error: invalid false>application of 'sizeof' to incomplete type false>'boost::STATIC_ASSERTION_FAILURE<false>' This is boost_1_39_0. I use operating system johannes@pc1:~/Progs/Components/Boost> uname -a Linux pc1 2.6.22.19 #1 PREEMPT Fri Apr 10 00:41:29 CEST 2009 x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux and compiler gcc version 4.3.2 (Gentoo 4.3.2-r3 p1.6, pie-10.1.5) I cannot understand, why list.push_front(n1) compiles, while list.push_back(n2) fails to compile. Thanks in advance for your help. Yours, Johannes Gajdosik
AMDG Johannes Gajdosik wrote:
From this piece of code
#include <boost/intrusive/slist.hpp>
class Node : public boost::intrusive::slist_base_hook<> { public: Node(int x) : x(x) {} int x; };
typedef boost::intrusive::slist<Node> List;
int main(int argc,char *argv[]) { List list; Node n1(1234); Node n2(5678); list.push_front(n1); list.push_back(n2); return 0; } ------------------------------------------ I get the following error:
false>boost_1_39_0/boost/intrusive/slist.hpp:382: error: invalid false>application of 'sizeof' to incomplete type false>'boost::STATIC_ASSERTION_FAILURE<false>' IntrusiveTest1.C:16:
The line that triggers the error is BOOST_STATIC_ASSERT((cache_last != 0)); slist does not support push_back by default. To allow push_back, you need to add the option cache_last: typedef boost::intrisive::slist<Node, cache_last<true> > List; In Christ, Steven Watanabe
participants (3)
-
Ion Gaztañaga
-
Johannes Gajdosik
-
Steven Watanabe