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

Peter Amstutz peter.amstutz at tseboston.com
Tue Apr 19 04:42:58 PDT 2011


On 4/19/2011 5:49 AM, Sukender wrote:
> hmmm...
>
> Why did you write
>     template<T> void addMeta(const std::string&, const Value<T>& v);
> ?
>
> Wouldn't this be simpler:
>     template<T> void addMeta(const std::string&, const T & v);
> ?
>
You're right, that is confusing.  Here's a better way to compare the
alternatives:

template<T> void addMeta(const std::string&, const Value<T>& v) {
  // Supports v as a subclass of Value<T>
  Value<T>* localcopy = v.clone();
}

template<T> void addMeta(const std::string&, const T & v) {
  // Can only customize Value<T> through template specialization
  Value<T>* localcopy = new Value<T>(v);
}

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




More information about the osg-users mailing list