X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fraw_convert.h;h=c392500989baffc3646e21a429845ca778f9b001;hb=5038e68ad9eb66e007211c8f1b707612a0c01e29;hp=3afb8f787e704a24c7624b42085bd174cedbe269;hpb=a8b629085c404d7a947ed242fbf64d8e0e91edcd;p=libsub.git diff --git a/src/raw_convert.h b/src/raw_convert.h index 3afb8f7..c392500 100644 --- a/src/raw_convert.h +++ b/src/raw_convert.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2019 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,15 +32,24 @@ template P raw_convert (Q v, int precision = 16) { - locked_stringstream s; - s.imbue (std::locale::classic ()); - s << std::setprecision (precision); - s << v; - P r; - s >> r; - return r; + /* We can't write a generic version of raw_convert; all required + versions must be specialised. + */ + BOOST_STATIC_ASSERT (sizeof (Q) == 0); } +template <> +int +raw_convert (std::string v, int); + +template <> +float +raw_convert (std::string v, int); + +template <> +std::string +raw_convert (unsigned long v, int); + }; #endif