示例#1
0
    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);
      }
    }
示例#2
0
    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);
      }
    }
示例#3
0
    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());
    }
示例#4
0
 bool  value_cted()const{return value_ptr==spc_ptr();}
示例#5
0
 void construct_value()const
 {
   if(!value_ptr)value_ptr=new(spc_ptr())value_type(key);
 }
示例#6
0
 void copy_value()const
 {
   if(!value_cted())value_ptr=new(spc_ptr())value_type(*value_ptr);
 }
示例#7
0
 void move_value()const
 {
   if(!value_cted())value_ptr=
     new(spc_ptr())value_type(std::move(const_cast<value_type&>(*value_ptr)));
 }