/////////////////////////////////////////////////////////////////////////////// // literals.hpp // // Copyright 2007 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_LITERALS_HPP_EAN_10_04_2005 #define BOOST_XPRESSIVE_DETAIL_UTILITY_LITERALS_HPP_EAN_10_04_2005 // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include // for BOOST_STATIC_CONSTANT #include // for BOOST_STATIC_CONSTANT #include namespace boost { namespace xpressive { namespace detail { /////////////////////////////////////////////////////////////////////////////// // char_literal // template struct char_literal; template struct char_literal { BOOST_STATIC_CONSTANT(boost::intmax_t, value = Ch); }; #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION template boost::intmax_t const char_literal::value; #endif template struct string_literal; template<> struct string_literal { static char const *pick(char const *cstr, wchar_t const *) { return cstr; } static char pick(char ch, wchar_t) { return ch; } }; template<> struct string_literal { static wchar_t const *pick(char const *, wchar_t const *cstr) { return cstr; } static wchar_t pick(char, wchar_t ch) { return ch; } }; #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) # define BOOST_XPR_CHAR_(Char, ch) ch # define BOOST_XPR_CSTR_(Char, st) boost::xpressive::detail::string_literal::pick(st, L##st) #else # define BOOST_XPR_CHAR_(Char, ch) boost::xpressive::detail::char_literal::value # define BOOST_XPR_CSTR_(Char, st) boost::xpressive::detail::string_literal::pick(st, L##st) #endif }}} // namespace boost::xpressive::detail #endif