MACE
1.0.0
|
00001 #ifndef _MACE_REFLECT_VALUE_CREF_HPP_ 00002 #define _MACE_REFLECT_VALUE_CREF_HPP_ 00003 #include <mace/reflect/value_base.hpp> 00004 00005 namespace mace { namespace reflect { 00006 00011 class value_cref : public value_base { 00012 public: 00013 template<typename T> value_cref( const T& v ); 00014 template<typename T> value_cref( const T&& t ); 00015 value_cref( const class value& t ); 00016 00017 value_cref( const value_cref& c ); 00018 value_cref( value_cref&& t ); 00019 00024 value_cref operator[]( const std::string& field )const; 00025 00026 template<typename T> 00027 inline const T& get()const; 00028 00029 template<typename T> 00030 inline const T* const_ptr()const; 00031 private: 00032 friend class value; 00033 00034 template<typename T> 00035 inline T& get(); 00036 00037 template<typename T> 00038 inline T* ptr(); 00039 00040 using value_base::get; 00041 using value_base::ptr; 00042 using value_base::set_as; 00043 00044 value_cref(){}; 00045 00047 template<typename T> 00048 void set_as(const T&&); 00049 00050 template<typename T> 00051 value_cref operator = (T){ return *this; } 00052 value_cref operator = ( const value_cref& v ); 00053 }; 00054 00055 00056 } } // namespace mace::reflect 00057 00058 00059 #endif