MACE
1.0.0
|
00001 #ifndef _MACE_REFLECT_VALUE_REF_HPP_ 00002 #define _MACE_REFLECT_VALUE_REF_HPP_ 00003 #include <mace/reflect/value_cref.hpp> 00004 00005 namespace mace { namespace reflect { 00006 00011 class value_ref : public value_base { 00012 00013 public: 00014 template<typename T> 00015 value_ref( T& v ); 00016 value_ref( const value_ref& ); 00017 value_ref( value_ref&& ); 00018 00019 operator value_cref()const; 00020 value_cref operator[]( const std::string& field )const; 00021 value_ref operator[]( const std::string& field ); 00022 00023 template<typename T> 00024 value_ref& operator=( const T& r ); 00025 00026 private: 00027 friend class value; 00028 // references must be provided a value at construction 00029 value_ref(){} 00030 value_ref(const class value_cref& ){} 00031 value_ref(const class value& ){} 00032 00033 // you cannot assign references after construction 00034 template<typename T> 00035 value_ref operator = (T){ return *this; } 00036 value_ref operator = ( const value_ref& v ); 00037 00038 // const ref types need not apply 00039 template<typename T> 00040 value_ref( const T& ); 00041 }; 00042 00043 00044 } } // namespace mace::reflect 00045 00046 00047 #endif