]> git.saurik.com Git - apple/system_cmds.git/blob - CPPUtil/UtilTRangeValue.hpp
7b50b73a50982bb726d9f9ce2aa0eabfc28b39c8
[apple/system_cmds.git] / CPPUtil / UtilTRangeValue.hpp
1 //
2 // UtilTRangeValue.hpp
3 // CPPUtil
4 //
5 // Created by James McIlree on 12/10/07.
6 // Copyright (c) 2013 Apple. All rights reserved.
7 //
8
9 #ifndef CPPUtil_UtilTRangeValue_hpp
10 #define CPPUtil_UtilTRangeValue_hpp
11
12 template <typename T1, typename T2>
13 class TRangeValue : public TRange<T1> {
14 protected:
15 T2 _value;
16
17 public:
18 TRangeValue(T1 location, T1 length, T2 value) : TRange<T1>(location, length), _value(value) { };
19
20 const T2 value() const { return _value; }
21
22 // Sometimes we need to reference the value as a mutable reference (think std::vector types)
23 T2& mutable_value() { return _value; }
24 };
25
26 #endif