$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [lexical_cast] How is the degenerate case handled?
From: jbosboom_at_[hidden]
Date: 2009-04-20 14:14:07
> This is not a common usecase and I see only one practical use of it.
A user might want to write a template that uses lexical_cast without
having to pay the performance cost when the cast isn't necessary.
Specializing lexical_cast for this case would save the user from having to
specialize his own template.
I'm guessing
template<typename Target>
Target lexical_cast(const Target& arg) {
return arg;
}
doesn't work because the compiler can't decide between lexical_cast<Foo>
and lexical_cast<Foo, Foo> for lexical_cast<Foo>(some_foo). Could
something like
template<typename T>
T lexical_cast<T, T>(const Target& arg)
work? (My syntax might not be perfect; it's been a while since I've done
partial specialization.)
--Jeffrey Bosboom