File indexing completed on 2025-01-18 09:40:48
0001 #ifndef BOOST_METAPARSE_V1_CPP11_IMPL_STRING_AT_HPP
0002 #define BOOST_METAPARSE_V1_CPP11_IMPL_STRING_AT_HPP
0003
0004
0005
0006
0007
0008
0009 #include <boost/metaparse/limit_string_size.hpp>
0010
0011 namespace boost
0012 {
0013 namespace metaparse
0014 {
0015 namespace v1
0016 {
0017 namespace impl
0018 {
0019 template <int MaxLen, int Len, class T>
0020 constexpr T string_at(const T (&s)[Len], int n)
0021 {
0022
0023
0024 static_assert(Len <= MaxLen + 1, "String literal is too long.");
0025 return n >= Len - 1 ? T() : s[n];
0026 }
0027 }
0028 }
0029 }
0030 }
0031
0032 #ifdef BOOST_METAPARSE_V1_STRING_AT
0033 # error BOOST_METAPARSE_V1_STRING_AT already defined
0034 #endif
0035 #define BOOST_METAPARSE_V1_STRING_AT \
0036 ::boost::metaparse::v1::impl::string_at<BOOST_METAPARSE_LIMIT_STRING_SIZE>
0037
0038 #endif
0039