Acsess boost::intrusive::list inside a map

I would like to store lists inside a map value. I can: typedef /*boost::intrusive*/list< ClassBase > ClassList; typedef unordered_map< Unit*, ClassList> ClassMap; ClassList someList; And everything works fine, But: ClassMap someMap. And add to access the list: classMap[ pUnit ].push_back( aClass ); I get errors: Thanks, Dan. I get: 1>C:\cpp\boost_1_42_0\boost/intrusive/list.hpp(1478) : error C2248: 'boost::intrusive::list_impl<Config>::list_impl' : cannot access private member declared in class 'boost::intrusive::list_impl<Config>' 1> with 1> [ 1> Config=boost::intrusive::listopt<boost::intrusive::detail::base_hook_traits<CmdBase,boost::intrusive::list_node_traits<void *>,safe_link,boost::intrusive::default_tag,1>,unsigned int,true> 1> ] 1> C:\cpp\boost_1_42_0\boost/intrusive/list.hpp(117) : see declaration of 'boost::intrusive::list_impl<Config>::list_impl' 1> with 1> [ 1> Config=boost::intrusive::listopt<boost::intrusive::detail::base_hook_traits<CmdBase,boost::intrusive::list_node_traits<void *>,safe_link,boost::intrusive::default_tag,1>,unsigned int,true> 1> ] 1> This diagnostic occurred in the compiler generated function 'boost::intrusive::list<T>::list(const boost::intrusive::list<T> &)' 1> with 1> [ 1> T=CmdBase 1> ] 1>C:\cpp\boost_1_42_0\boost/intrusive/list.hpp(1478) : error C2248: 'boost::intrusive::list_impl<Config>::list_impl' : cannot access private member declared in class 'boost::intrusive::list_impl<Config>' 1> with 1> [ 1> Config=boost::intrusive::listopt<boost::intrusive::detail::base_hook_traits<CmdBase,boost::intrusive::list_node_traits<void *>,safe_link,boost::intrusive::default_tag,1>,unsigned int,true> 1> ] 1> C:\cpp\boost_1_42_0\boost/intrusive/list.hpp(117) : see declaration of 'boost::intrusive::list_impl<Config>::list_impl' 1> with 1> [ 1> Config=boost::intrusive::listopt<boost::intrusive::detail::base_hook_traits<CmdBase,boost::intrusive::list_node_traits<void *>,safe_link,boost::intrusive::default_tag,1>,unsigned int,true> 1> ] 1> This diagnostic occurred in the compiler generated function 'boost::intrusive::list<T>::list(const boost::intrusive::list<T> &)' 1> with 1> [ 1> T=CmdBase 1> ]

El 11/03/2011 20:19, Dan Bloomquist escribió:
I would like to store lists inside a map value. I can:
typedef /*boost::intrusive*/list< ClassBase > ClassList;
You can't because intrusive containers are not copyable. They will be movable in the future once Boost.Move is integrated in trunk and ::boost::unordered_map accepts movable classes. Meanwhile perhaps you can use emplace to construct directly the value in the map, but I don't know if that will work. Ion

Ion Gaztañaga wrote:
El 11/03/2011 20:19, Dan Bloomquist escribió:
I would like to store lists inside a map value. I can:
typedef /*boost::intrusive*/list< ClassBase > ClassList;
You can't because intrusive containers are not copyable. They will be movable in the future once Boost.Move is integrated in trunk and ::boost::unordered_map accepts movable classes. Meanwhile perhaps you can use emplace to construct directly the value in the map, but I don't know if that will work.
Yes, thanks, now I see it is about instantiation. I can write map_it->second.push_back( ... ) without error. But: cmdMap.emplace( std::pair< Unit*, CommandList > ( ait->pUnit, CommandList( ) ) ); gets me the same error: C:\cpp\boost_1_42_0\boost/intrusive/list.hpp(1478) : error C2248: 'boost::intrusive::list_impl<Config>::list_impl' : cannot access private member declared in class 'boost::intrusive::list_impl<Config>' ... I'll see about doing this the smart pointer way. Best, Dan.
Ion _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Dan Bloomquist
-
Ion Gaztañaga