fixup lexical cast implementation.

gcc wouldn't compile this when "from" was of type enum, because
it says it wouldn't be initialized. The explicit call to default
constructor fixes it. Thanks to gfgtdf for this simple fix to
this problem.
This commit is contained in:
Chris Beck 2014-05-24 17:43:37 -04:00
parent 17d63fce9d
commit 0e2e54c632

View file

@ -88,7 +88,7 @@ struct bad_lexical_cast : public std::exception
template<typename To, typename From>
To lexical_cast(From a)
{
To res;
To res = To();
std::stringstream str;
if(str << a && str >> res) {
@ -101,7 +101,7 @@ To lexical_cast(From a)
template<typename To, typename From>
To lexical_cast_default(From a, To def=To())
{
To res;
To res = To();
std::stringstream str;
if(str << a && str >> res) {