Opened 11 years ago

Closed 11 years ago

#6260 closed Bugs (invalid)

boost::multi_index can not work with nedmalloc

Reported by: wucy <sheqq_10@…> Owned by: Joaquín M López Muñoz
Milestone: To Be Determined Component: None
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

I store terminal struct using multi_index,

typedef boost::multi_index_container<

terminal*, boost::multi_index::indexed_by<

boost::multi_index::hashed_unique<

boost::multi_index::member<

terminal, unsigned int, &terminal::logic_addr_> >,

boost::multi_index::hashed_non_unique<

boost::multi_index::member<

terminal, unsigned int, &terminal::master_logic_addr_> > >,

nedalloc::nedallocator<terminal* > >

terminal_map;

but there is some error in compile. the error is following:

1>e:\tmr\src\communicators\nedmalloc\nedmalloc.h(1338) : error C2248: 'nedalloc::nedallocatorI::baseimplementation<implementation>::operator =' : cannot access private member declared in class 'nedalloc::nedallocatorI::baseimplementation<implementation>' 1> with 1> [ 1> implementation=nedalloc::nedallocator<boost::multi_index::detail::hashed_index_node_impl<nedalloc::nedallocator<char,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty>>,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty> 1> ] 1> e:\tmr\src\communicators\nedmalloc\nedmalloc.h(1060) : see declaration of 'nedalloc::nedallocatorI::baseimplementation<implementation>::operator =' 1> with 1> [ 1> implementation=nedalloc::nedallocator<boost::multi_index::detail::hashed_index_node_impl<nedalloc::nedallocator<char,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty>>,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty> 1> ] 1> This diagnostic occurred in the compiler generated function 'nedalloc::nedallocator<T,policy1,policy2,policy3,policy4,policy5,policy6,policy7,policy8,policy9,policy10,policy11,policy12,policy13,policy14,policy15> &nedalloc::nedallocator<T,policy1,policy2,policy3,policy4,policy5,policy6,policy7,policy8,policy9,policy10,policy11,policy12,policy13,policy14,policy15>::operator =(const nedalloc::nedallocator<T,policy1,policy2,policy3,policy4,policy5,policy6,policy7,policy8,policy9,policy10,policy11,policy12,policy13,policy14,policy15> &)' 1> with 1> [ 1> T=boost::multi_index::detail::hashed_index_node_impl<nedalloc::nedallocator<char,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty,nedalloc::nedpolicy::empty>>, 1> policy1=nedalloc::nedpolicy::empty, 1> policy2=nedalloc::nedpolicy::empty, 1> policy3=nedalloc::nedpolicy::empty, 1> policy4=nedalloc::nedpolicy::empty, 1> policy5=nedalloc::nedpolicy::empty, 1> policy6=nedalloc::nedpolicy::empty, 1> policy7=nedalloc::nedpolicy::empty, 1> policy8=nedalloc::nedpolicy::empty, 1> policy9=nedalloc::nedpolicy::empty, 1> policy10=nedalloc::nedpolicy::empty, 1> policy11=nedalloc::nedpolicy::empty, 1> policy12=nedalloc::nedpolicy::empty, 1> policy13=nedalloc::nedpolicy::empty, 1> policy14=nedalloc::nedpolicy::empty, 1> policy15=nedalloc::nedpolicy::empty 1> ]

Change History (2)

comment:1 by Joaquín M López Muñoz, 11 years ago

Owner: changed from mariomulansky to Joaquín M López Muñoz

Hello,

This is a messy part of the standard. Allocators are not required to be assignable, but it they're stateful (which the standard recommmends to support) then efficient container swap has to resort to swapping allocators as well: unfortunately there's no compile-time way to determine if a given allocator type is stateful, and assigning (or swapping) multi_index_containers implicitly invoke allocator assignment.

You're simplest workaround is to define (possibly as a do-nothing function) operator= for nedallocator. Defining a swap function for nedallocators (within the same namespace as nedallocators are defined) will work too.

comment:2 by Joaquín M López Muñoz, 11 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.