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

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to