views:

35

answers:

1

Why can I not do this?

typedef boost::interprocess::unique_ptr<QueueList, QueueListDeletor> UQList;
typedef boost::intrusive::list<UQList> List;  // Compiler (VS 2003) complains 

The QueueList is a class that derives from public boost::intrusive::list_base_hook<> to make it part of an intrusive linked list.

I want to use unique_ptr to be able to pass around this object between threads and only have 1 single thread have ownership of this object at the time.

EDIT: ERRORS:

error C2039: 'pointer' : is not a member of 'boost::intrusive::detail::default_list_hook' see declaration of 'boost::intrusive::detail::default_list_hook' see reference to class template instantiation 'boost::intrusive::list_impl' being compiled with [ Config=boost::intrusive::listopt::value_traits,boost::intrusive::size_type::pack>::type,boost::intrusive::constant_time_size>::type>::size_type,true> ]

error C2039: 'const_pointer' : is not a member of 'boost::intrusive::detail::default_list_hook' see declaration of 'boost::intrusive::detail::default_list_hook'

+2  A: 

QueueList may be derived from list_base_hook, but UQList certainly isn't. Since you try to create an intrusive list of UQList (which is a unique_ptr) and not an intrusive list of QueueList objects, this won't work.

sellibitze