void construct_value()const { if(!value_cted()){ /* value_ptr must be ==0, oherwise copy_value would have been called */ key_type k(*key_ptr()); key_ptr()->~key_type(); value_ptr= /* guarantees key won't be re-dted at ~rep_type if the */ static_cast<value_type*>(spc_ptr())+1; /* next statement throws */ value_ptr=new(spc_ptr())value_type(k); } }
void construct_value()const { if(!value_cted()){ /* value_ptr must be ==0, oherwise copy_value would have been called */ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) key_type k(std::move(*key_ptr())); #else key_type k(*key_ptr()); #endif key_ptr()->~key_type(); value_ptr= /* guarantees key won't be re-dted at ~rep_type if the */ static_cast<value_type*>(spc_ptr())+1; /* next statement throws */ value_ptr=new(spc_ptr())value_type(k); } }
operator const value_type&()const { /* This is always called after construct_value() or copy_value(), * so we access spc directly rather than through value_ptr to * save us an indirection. */ return *static_cast<value_type*>(spc_ptr()); }
bool value_cted()const{return value_ptr==spc_ptr();}
void construct_value()const { if(!value_ptr)value_ptr=new(spc_ptr())value_type(key); }
void copy_value()const { if(!value_cted())value_ptr=new(spc_ptr())value_type(*value_ptr); }
void move_value()const { if(!value_cted())value_ptr= new(spc_ptr())value_type(std::move(const_cast<value_type&>(*value_ptr))); }