00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef LOKI_REFTOVALUE_INC_
00014 #define LOKI_REFTOVALUE_INC_
00015
00016
00017
00018
00019 namespace Loki
00020 {
00021
00029
00030 template <class T>
00031 class RefToValue
00032 {
00033 public:
00034
00035 RefToValue(T& ref) : ref_(ref)
00036 {}
00037
00038 RefToValue(const RefToValue& rhs) : ref_(rhs.ref_)
00039 {}
00040
00041 operator T& () const
00042 {
00043 return ref_;
00044 }
00045
00046 private:
00047
00048 RefToValue();
00049 RefToValue& operator=(const RefToValue&);
00050
00051 T& ref_;
00052 };
00053
00054
00059
00060 template <class T>
00061 inline RefToValue<T> ByRef(T& t)
00062 {
00063 return RefToValue<T>(t);
00064 }
00065
00066 }
00067
00068
00069 #endif // end file guardian
00070