flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
string_format.cpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
19#include "string_format.hpp"
20#include <boost/lexical_cast.hpp>
21
22namespace flexiblesusy {
23
24#define DEFINE_TO_STRING(type) \
25 std::string to_string(type a) \
26 { \
27 return boost::lexical_cast<std::string>(a); \
28 }
29
31DEFINE_TO_STRING(unsigned char );
32DEFINE_TO_STRING(unsigned short );
33DEFINE_TO_STRING(unsigned int );
34DEFINE_TO_STRING(unsigned long );
35DEFINE_TO_STRING(unsigned long long);
36DEFINE_TO_STRING(signed char );
37DEFINE_TO_STRING(signed short );
38DEFINE_TO_STRING(signed int );
39DEFINE_TO_STRING(signed long );
40DEFINE_TO_STRING(signed long long );
42
43std::string to_string(const std::complex<double>& a)
44{
45 return "(" + to_string(std::real(a)) + "," + to_string(std::imag(a)) + ")";
46}
47
48} // namespace flexiblesusy
std::string to_string(char a)
#define DEFINE_TO_STRING(type)