Let say we have

 

struct A {…}; struct B {…}; struct C {…};

 

And we define a container of objects that hold these three structures:

 

 

struct Whole { A a; B b; C c; };

 

multi_index_container<Whole,

                   indexed_by< ordered_unique< member<Whole, A, &Whole::a> > >,

                   indexed_by< ordered_unique< member<Whole, A, &Whole::b> > >

> 

container;

 

As you can see only a and b are the keys, c is just a member.

 

Let’s also say that we’ve got an iterator  “it” pointing to an element in the container

(through what index the iterator has been retrieved is immaterial at this point).

 

And we want to modify “c” member of that element.

 

Is this safe:

 

*const_cast<C **>(&it->c) = <new value of c>   ???

 

I know that one can use “modify” member function, but it seems an overkill to have to create a separate

functor just to update a non-key element. Plus, member does additional checks on collision, and the

performance may suffer as a result.

 

Thanks,

     Andy.