1 #ifndef BOOST_METAPARSE_V1_CPP11_STRING_HPP
2 #define BOOST_METAPARSE_V1_CPP11_STRING_HPP
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #include <boost/metaparse/v1/cpp11/fwd/string.hpp>
10 #include <boost/metaparse/v1/string_tag.hpp>
11 #include <boost/metaparse/v1/impl/string_iterator.hpp>
12 #include <boost/metaparse/v1/cpp11/impl/empty_string.hpp>
13 #include <boost/metaparse/v1/cpp11/impl/size.hpp>
14 #include <boost/metaparse/v1/cpp11/impl/pop_front.hpp>
15 #include <boost/metaparse/v1/cpp11/impl/push_front_c.hpp>
16 #include <boost/metaparse/v1/cpp11/impl/push_back_c.hpp>
17 #include <boost/metaparse/v1/cpp11/impl/pop_back.hpp>
18 #include <boost/metaparse/v1/cpp11/impl/string_at.hpp>
20 #include <type_traits>
36 typedef string_tag tag;
52 struct push_back_impl;
55 struct push_back_impl<boost::metaparse::v1::string_tag>
57 typedef push_back_impl type;
59 template <class S, class C>
61 boost::metaparse::v1::impl::push_back_c<
73 struct pop_back_impl<boost::metaparse::v1::string_tag>
75 typedef pop_back_impl type;
78 struct apply : boost::metaparse::v1::impl::pop_back<S> {};
83 struct push_front_impl;
86 struct push_front_impl<boost::metaparse::v1::string_tag>
88 typedef push_front_impl type;
90 template <class S, class C>
92 boost::metaparse::v1::impl::push_front_c<
101 struct pop_front_impl;
104 struct pop_front_impl<boost::metaparse::v1::string_tag>
106 typedef pop_front_impl type;
109 struct apply : boost::metaparse::v1::impl::pop_front<S> {};
117 struct clear_impl<boost::metaparse::v1::string_tag>
119 typedef clear_impl type;
122 struct apply : boost::metaparse::v1::string<> {};
130 struct begin_impl<boost::metaparse::v1::string_tag>
132 typedef begin_impl type;
136 boost::metaparse::v1::impl::string_iterator<typename S::type, 0>
145 struct end_impl<boost::metaparse::v1::string_tag>
147 typedef end_impl type;
151 boost::metaparse::v1::impl::string_iterator<
153 boost::metaparse::v1::impl::size<typename S::type>::type::value
159 template <class A, class B>
160 struct equal_to_impl;
163 struct equal_to_impl<
164 boost::metaparse::v1::string_tag,
165 boost::metaparse::v1::string_tag
168 typedef equal_to_impl type;
170 template <class A, class B>
171 struct apply : std::is_same<typename A::type, typename B::type> {};
175 struct equal_to_impl<boost::metaparse::v1::string_tag, T>
177 typedef equal_to_impl type;
179 template <class, class>
180 struct apply : false_ {};
184 struct equal_to_impl<T, boost::metaparse::v1::string_tag> :
185 equal_to_impl<boost::metaparse::v1::string_tag, T>
192 template <char... Cs>
193 struct c_str<boost::metaparse::v1::string<Cs...>>
196 static constexpr char value[sizeof...(Cs) + 1] = {Cs..., 0};
200 struct c_str<boost::metaparse::v1::string<>> :
201 boost::metaparse::v1::impl::empty_string<>
204 template <char... Cs>
205 constexpr char c_str<boost::metaparse::v1::string<Cs...>>::value[];
210 # if __has_extension(cxx_string_literal_templates)
211 # define BOOST_METAPARSE_V1_STRING(...) ::boost::metaparse::string<__VA_ARGS__>
213 # include <boost/metaparse/v1/cpp11/impl/string.hpp>
216 # include <boost/metaparse/v1/cpp11/impl/string.hpp>