Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-12-04 09:17:14


In message <00ef01c05df7$b3caede0$4c0524d4_at_pdimov>, Peter Dimov
<pdimov_at_[hidden]> writes
>Write it with the const on the right:
>
>template< typename T, typename S > T lexical_cast( S const & arg );
>
>template<> string lexical_cast< string, char* >( char const * & arg );
>
>Now it is clear that the declarations don't match. You'd need
>
>template<> string lexical_cast< string, char const * >( char const * const &
>arg );
>
>but this wouldn't work either, because
>
>lexical_cast<int>("Hello")
>
>is actually
>
>lexical_cast<int, char const (&) [6]>("Hello").

I think all of this seems to suggest retaining the status quo: pass by
copy rather than pass by const reference. Given that this involves no
change to the code, I am happy with that :-)

Kevlin
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  Curbralan Limited mobile: +44 7801 073 508
  mailto:kevlin_at_[hidden] fax: +44 870 052 2289
  http://www.curbralan.com
____________________________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk