1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6
7// This file was modified by Oracle on 2015-2021.
8// Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
9// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
10// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11
12// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14
15// Use, modification and distribution is subject to the Boost Software License,
16// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17// http://www.boost.org/LICENSE_1_0.txt)
18
19#ifndef GEOMETRY_TEST_STRING_FROM_TYPE_HPP
20#define GEOMETRY_TEST_STRING_FROM_TYPE_HPP
21
22#include <string>
23
24#include <boost/multiprecision/cpp_bin_float.hpp>
25
26template <typename T>
27struct string_from_type
28{ static std::string name() { return "?"; } };
29
30template <> struct string_from_type<void>
31{ static std::string name() { return "v"; } };
32
33template <> struct string_from_type<float>
34{ static std::string name() { return "f"; } };
35
36template <> struct string_from_type<double>
37{ static std::string name() { return "d"; } };
38
39template <> struct string_from_type<long double>
40{ static std::string name() { return "e"; } };
41
42template <> struct string_from_type<short int>
43{ static std::string name() { return "s"; } };
44
45template <> struct string_from_type<int>
46{ static std::string name() { return "i"; } };
47
48template <> struct string_from_type<long>
49{ static std::string name() { return "l"; } };
50
51template <typename Backend>
52struct string_from_type<boost::multiprecision::number<Backend>>
53{ static std::string name() { return "m"; } };
54
55// this is what g++ and clang++ use
56template <> struct string_from_type<long long>
57{ static std::string name() { return "x"; } };
58
59#if defined(BOOST_HAS_INT128)
60// this is what g++ and clang++ use
61template <> struct string_from_type<boost::int128_type>
62{ static std::string name() { return "n"; } };
63#endif
64
65#if defined(BOOST_RATIONAL_HPP)
66template <typename T> struct string_from_type<boost::rational<T> >
67{ static std::string name() { return "r"; } };
68#endif
69
70#endif // GEOMETRY_TEST_STRING_FROM_TYPE_HPP
71

source code of boost/libs/geometry/test/string_from_type.hpp