|
Boost : |
From: d.frey_at_[hidden]
Date: 2000-12-04 11:41:10
--- In boost_at_[hidden], "Peter Dimov" <pdimov_at_m...> wrote:
> template<class T, class S> struct lexical_cast_helper
> {
> T call(S const & s); // original definition goes here
> };
>
> template<class T, class S> T lexical_cast(S const& s)
> {
> return lexical_cast_helper<T, S>::call(s);
> }
>
> Now you can partially specialize lexical_cast_helper<T, S>.
Hm, not me. Maybe I'm not clever enough. I changed lexical_cast as you
suggested and made 'call' a static function. Worked fine. Next, I
tried to specialize it:
typedef const char U[];
template<> string lexical_cast_helper< string, U >::call( const U& arg
)
{
return string( arg );
}
But my compiler says:
t.cc:39: parameter type `const char (&)[]' includes reference to array
of unknown bound
Although now the type looks "nearly" correct to me, the compiler wants
to have the actual size. Is this the same problem why I cannot
specialize for T == S? Or do I overlook something?
Regards, Daniel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk