aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/contrib/to_string.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/contrib/to_string.hpp')
-rw-r--r--MoonParser/pegtl/contrib/to_string.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/MoonParser/pegtl/contrib/to_string.hpp b/MoonParser/pegtl/contrib/to_string.hpp
new file mode 100644
index 0000000..4c19931
--- /dev/null
+++ b/MoonParser/pegtl/contrib/to_string.hpp
@@ -0,0 +1,42 @@
1// Copyright (c) 2017 Dr. Colin Hirsch and Daniel Frey
2// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
3
4#ifndef TAOCPP_PEGTL_INCLUDE_CONTRIB_TO_STRING_HPP
5#define TAOCPP_PEGTL_INCLUDE_CONTRIB_TO_STRING_HPP
6
7#include <string>
8
9#include "../config.hpp"
10
11namespace tao
12{
13 namespace TAOCPP_PEGTL_NAMESPACE
14 {
15 namespace internal
16 {
17 template< typename >
18 struct to_string;
19
20 template< template< char... > class X, char... Cs >
21 struct to_string< X< Cs... > >
22 {
23 static std::string get()
24 {
25 const char s[] = { Cs..., 0 };
26 return std::string( s, sizeof...( Cs ) );
27 }
28 };
29
30 } // namespace internal
31
32 template< typename T >
33 std::string to_string()
34 {
35 return internal::to_string< T >::get();
36 }
37
38 } // namespace TAOCPP_PEGTL_NAMESPACE
39
40} // namespace tao
41
42#endif