[osg-users] Meta-data in core OSG - project started

Peter Amstutz peter.amstutz at tseboston.com
Tue Apr 19 04:47:34 PDT 2011


Immutable means "cannot be changed".  So I mean that the "Value" class
should not have a "set" method and all "get" methods should be const.  E.g.

template<T>
class Value {
private:
  T v;

public:
  Value(const T& _v) : v(_v) { }

  const T& get() { return v; }

  // type conversion operator, so you can write
  // Value<int> a(5);
  // int b = a;
  const T& operator T () { return v; }
};


On 4/19/2011 5:46 AM, Sukender wrote:
> Hi Peter,
>
> Okay, we'll certainely try your ideas. I guess ValueBase is meant to be derived, but Value<T> isn't.
>
> However, I'm not sure I understand the "immutable" thing. Do you mean you preference goes to
>    function( someParam )
> rather than
>    function( Value<SomeType>(someParam) )
> ?
>
> If so, yes. And that's of course easier to write and read.

-- 
Peter Amstutz
Senior Software Engineer
Technology Solutions Experts
Natick, MA
02131




More information about the osg-users mailing list