/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
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
#ifndef LIBSUB_RAW_CONVERT_H
#define LIBSUB_RAW_CONVERT_H
-#include <locked_sstream.h>
+#include "util.h"
+#include <boost/static_assert.hpp>
#include <iomanip>
namespace sub {
*/
template <typename P, typename Q>
P
-raw_convert (Q v, int precision = 16)
+raw_convert (Q, 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);
+ LIBSUB_UNUSED (precision);
}
+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