コード例 #1
0
ファイル: key_value.hpp プロジェクト: AlexMioMio/boost
    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
ファイル: key_value.hpp プロジェクト: imos/icfpc2015
    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
ファイル: key_value.hpp プロジェクト: AlexMioMio/boost
 ~rep_type()
 {
   if(!value_ptr)       key_ptr()->~key_type();
   else if(value_cted())value_ptr->~value_type();
 }
コード例 #4
0
ファイル: key_value.hpp プロジェクト: AlexMioMio/boost
 void copy_value()const
 {
   if(!value_cted())value_ptr=new(spc_ptr())value_type(*value_ptr);
 }
コード例 #5
0
ファイル: key_value.hpp プロジェクト: imos/icfpc2015
 void move_value()const
 {
   if(!value_cted())value_ptr=
     new(spc_ptr())value_type(std::move(const_cast<value_type&>(*value_ptr)));
 }