|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-08-25 14:19:43
"Judd Tracy" <jtracy_at_[hidden]> writes:
> I am trying to use boost:add_reference in a template function to protect
> against the reference of reference problems, but it is breaking type
> deduction and I was wondering if any one know of a solution to this.
>
> template<typename Type>
> read(std::istream& stream, Type& data);
>
> This works properly of course.
And it's already protected. If you are passing a reference type U& as
the 2nd argument, Type will always be deduced as U. You don't need
add_reference here.
> -----------------------------------------
>
> template<typename Type>
> read (std::istream& stream, typename boost::add_reference<Type>::type data);
>
> This one does not work properly and I have to explicitly specify the type.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk