Index: boost/mpl/char_fwd.hpp =================================================================== --- boost/mpl/char_fwd.hpp (revision 0) +++ boost/mpl/char_fwd.hpp (revision 0) @@ -0,0 +1,27 @@ + +#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED +#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED + +// Copyright Eric Niebler 2008 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $ +// $Revision: 24874 $ + +#include +#include + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN + +template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +BOOST_MPL_AUX_ADL_BARRIER_DECL(char_) + +#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED Index: boost/mpl/string.hpp =================================================================== --- boost/mpl/string.hpp (revision 0) +++ boost/mpl/string.hpp (revision 0) @@ -0,0 +1,396 @@ + +#ifndef BOOST_MPL_STRING_HPP_INCLUDED +#define BOOST_MPL_STRING_HPP_INCLUDED + +// Copyright Eric Niebler 2009 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $ +// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49239 $ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + #ifndef BOOST_MPL_STRING_MAX_LENGTH + # define BOOST_MPL_STRING_MAX_LENGTH 32 + #endif + + #define BOOST_MPL_STRING_MAX_PARAMS BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_STRING_MAX_LENGTH, 3), 4) + + #define BOOST_MPL_MULTICHAR_LENGTH(c) (std::size_t)((c>0xffffff)+(c>0xffff)+(c>0xff)+1) + #define BOOST_MPL_MULTICHAR_AT(c,i) (char)(0xff&(c>>(8*(BOOST_MPL_MULTICHAR_LENGTH(c)-(std::size_t)(i)-1)))) + + struct string_tag; + struct string_iterator_tag; + + template + struct string; + + template + struct string_iterator; + + template + struct sequence_tag; + + template + struct size_impl; + + template<> + struct size_impl + { + template + struct apply + : mpl::size_t + {}; + }; + + template + struct at_impl; + + template<> + struct at_impl + { + template + struct apply + : Sequence::template at + {}; + }; + + template + struct begin_impl; + + template<> + struct begin_impl + { + template + struct apply + { + typedef string_iterator type; + }; + }; + + template + struct end_impl; + + template<> + struct end_impl + { + template + struct apply + { + typedef string_iterator type; + }; + }; + + template + struct push_back_impl; + + template<> + struct push_back_impl + { + template + struct apply + { + BOOST_MPL_ASSERT_MSG(false, PUSH_BACK_FAILED_MPL_STRING_IS_FULL, (Sequence)); + typedef void type; + }; + + template + struct apply, Value, false> + { + typedef string<(char)Value::value> type; + }; + + #define M0(z,n,data) \ + template \ + struct apply, Value, false> \ + { \ + typedef string< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + (BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \ + ?BOOST_PP_CAT(C,BOOST_PP_DEC(n)) \ + :(BOOST_PP_CAT(C,BOOST_PP_DEC(n))<<8)|(unsigned char)Value::value \ + , (BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \ + ?(char)Value::value \ + :0 \ + > type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~) + #undef M0 + + template + struct apply, Value, false> + { + typedef string< + BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), C) + , (BOOST_PP_CAT(C,BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS))<<8)|(unsigned char)Value::value + > type; + }; + }; + + template + struct push_front_impl; + + template<> + struct push_front_impl + { + template + struct apply + { + BOOST_MPL_ASSERT_MSG(false, PUSH_FRONT_FAILED_MPL_STRING_IS_FULL, (Sequence)); + typedef void type; + }; + + template + struct apply, Value, false> + { + typedef string<(char)Value::value> type; + }; + + #define M0(z,n,data) \ + template \ + struct apply, Value, true> \ + { \ + typedef string< \ + (char)Value::value \ + BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, C) \ + > type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~) + #undef M0 + + template + struct apply, Value, false> + { + typedef string< + ((((unsigned char)Value::value)<<(BOOST_MPL_MULTICHAR_LENGTH(C0)*8))|C0) + , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C) + > type; + }; + }; + + template + struct insert_range_impl; + + template<> + struct insert_range_impl + { + template + struct apply + : copy< + joint_view< + iterator_range< + string_iterator + , Pos + > + , joint_view< + Range + , iterator_range< + Pos + , string_iterator + > + > + > + , back_inserter > + > + {}; + }; + + template + struct insert_impl; + + template<> + struct insert_impl + { + template + struct apply + : insert_range > + {}; + }; + + template + struct erase_impl; + + template<> + struct erase_impl + { + template + struct apply + : copy< + joint_view< + iterator_range< + string_iterator + , First + > + , iterator_range< + typename if_na::type>::type + , string_iterator + > + > + , back_inserter > + > + {}; + }; + + template + struct clear_impl; + + template<> + struct clear_impl + { + template + struct apply + { + typedef string<> type; + }; + }; + + template + struct advance_impl; + + template<> + struct advance_impl + { + template + struct apply + { + typedef string_iterator< + typename Iterator::string_type + , Iterator::index + N::value + > type; + }; + }; + + template + struct distance_impl; + + template<> + struct distance_impl + { + template + struct apply + { + typedef mpl::long_ type; + }; + }; + + template + struct string_iterator + : Sequence::template at + { + typedef string_iterator_tag tag; + typedef std::random_access_iterator_tag category; + typedef Sequence string_type; + static long const index = N; + typedef string_iterator next; + typedef string_iterator prior; + }; + + template + struct string + { + /// INTERNAL ONLY + static unsigned int const front_ = C0; + /// INTERNAL ONLY + static unsigned int const back_ = BOOST_PP_CAT(C, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)); + /// INTERNAL ONLY + typedef string rest_; + + typedef string type; + + typedef string_tag tag; + + static std::size_t const size = BOOST_MPL_MULTICHAR_LENGTH(C0) + rest_::size; + + template + struct at + : boost::mpl::char_ + {}; + + template + struct at + : rest_::template at + {}; + + static char const c_str[]; + }; + + template + char const string::c_str[] = + { + #define M0(z, n, data) at::value + BOOST_PP_ENUM(BOOST_MPL_STRING_MAX_LENGTH, M0, ~) + #undef M0 + , '\0' // to ensure the string is null-terminated + }; + + template + std::size_t const string::size; + + template + unsigned int const string::front_; + + template + unsigned int const string::back_; + + template<> + struct string<> + { + /// INTERNAL ONLY + static unsigned int const front_ = 0; + /// INTERNAL ONLY + static unsigned int const back_ = 0; + /// INTERNAL ONLY + typedef string rest_; + + typedef string type; + + typedef string_tag tag; + + static std::size_t const size = 0; + + template + struct at + : boost::mpl::char_<'\0'> + {}; + + static char const c_str[]; + }; + + char const string<>::c_str[] = {'\0'}; + std::size_t const string<>::size; + unsigned int const string<>::front_; + unsigned int const string<>::back_; + +}} // namespace boost + +#endif // BOOST_MPL_STRING_HPP_INCLUDED Index: boost/mpl/char.hpp =================================================================== --- boost/mpl/char.hpp (revision 0) +++ boost/mpl/char.hpp (revision 0) @@ -0,0 +1,22 @@ + +#ifndef BOOST_MPL_CHAR_HPP_INCLUDED +#define BOOST_MPL_CHAR_HPP_INCLUDED + +// Copyright Eric Niebler 2008 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $ +// $Revision: 24874 $ + +#include + +#define AUX_WRAPPER_VALUE_TYPE char +#include + +#endif // BOOST_MPL_CHAR_HPP_INCLUDED Index: libs/mpl/test/string.cpp =================================================================== --- libs/mpl/test/string.cpp (revision 0) +++ libs/mpl/test/string.cpp (revision 0) @@ -0,0 +1,173 @@ + +// Copyright Eric Niebler 2009 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: string.cpp 49240 2009-04-01 09:21:07Z eric_niebler $ +// $Date: 2009-04-01 02:21:07 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49240 $ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace mpl = boost::mpl; + +// Accept a string as a template parameter! +template +struct greeting +{ + std::string say_hello() const + { + return sz; + } +}; + +struct push_char +{ + push_char(std::string &str) + : str_(&str) + {} + + void operator()(char ch) const + { + this->str_->push_back(ch); + } + + std::string *str_; +}; + +void test1() +{ + BOOST_TEST(0 == std::strcmp(mpl::string<'Hell','o wo','rld!'>::c_str, "Hello world!")); + BOOST_TEST((12 == mpl::size >::type::value)); + BOOST_TEST(('w' == mpl::at_c, 6>::type::value)); + + // test using a string as a template parameter + greeting::c_str> g; + BOOST_TEST("Hello world!" == g.say_hello()); + + BOOST_TEST(0 == std::strcmp("", mpl::string<>::c_str)); + + std::string result; + mpl::for_each >(push_char(result)); + BOOST_TEST("Hello world!" == result); + + BOOST_MPL_ASSERT((mpl::empty >)); + BOOST_MPL_ASSERT_NOT((mpl::empty >)); + + BOOST_TEST(('h' == mpl::front >::type())); + BOOST_TEST(('!' == mpl::back >::type())); +} + +// testing push_back +void test2() +{ + typedef mpl::push_back, mpl::char_<'a'> >::type t1; + BOOST_TEST(0 == std::strcmp("a", t1::c_str)); + + typedef mpl::push_back >::type t2; + BOOST_TEST(0 == std::strcmp("ab", t2::c_str)); + + typedef mpl::push_back >::type t3; + BOOST_TEST(0 == std::strcmp("abc", t3::c_str)); + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t4; + BOOST_TEST(0 == std::strcmp("abcd", t4::c_str)); + + typedef mpl::push_back >::type t5; + BOOST_TEST(0 == std::strcmp("abcde", t5::c_str)); + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaa'> almost_full; + BOOST_TEST(0 == std::strcmp("aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaa", almost_full::c_str)); + + typedef mpl::push_back >::type t6; + BOOST_TEST(0 == std::strcmp("aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaX", t6::c_str)); +} + +// testing push_front +void test3() +{ + typedef mpl::push_front, mpl::char_<'a'> >::type t1; + BOOST_TEST(0 == std::strcmp("a", t1::c_str)); + + typedef mpl::push_front >::type t2; + BOOST_TEST(0 == std::strcmp("ba", t2::c_str)); + + typedef mpl::push_front >::type t3; + BOOST_TEST(0 == std::strcmp("cba", t3::c_str)); + + typedef mpl::push_front >::type t4; + BOOST_TEST(0 == std::strcmp("dcba", t4::c_str)); + + typedef mpl::push_front >::type t5; + BOOST_TEST(0 == std::strcmp("edcba", t5::c_str)); + + typedef mpl::string<'aaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa'> almost_full; + BOOST_TEST(0 == std::strcmp("aaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa", almost_full::c_str)); + + typedef mpl::push_front >::type t6; + BOOST_TEST(0 == std::strcmp("Xaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa", t6::c_str)); +} + +void test4() +{ + // back-inserter with copy + typedef mpl::vector_c rgc; + typedef mpl::copy > >::type str; + BOOST_TEST(0 == std::strcmp("abcde", str::c_str)); +} + +// test insert_range and erase +void test5() +{ + typedef mpl::string<'Hell','o wo','rld!'> hello; + typedef mpl::advance_c::type, 5>::type where; + typedef mpl::string<' cru','el'> cruel; + typedef mpl::insert_range::type hello_cruel; + BOOST_TEST(0 == std::strcmp("Hello cruel world!", hello_cruel::c_str)); + + typedef mpl::erase::type, where>::type erased1; + BOOST_TEST(0 == std::strcmp(" world!", erased1::c_str)); +} + + +int main() +{ + test1(); + test2(); + test3(); + test4(); + test5(); + + return boost::report_errors(); +} Index: libs/mpl/test/char.cpp =================================================================== --- libs/mpl/test/char.cpp (revision 0) +++ libs/mpl/test/char.cpp (revision 0) @@ -0,0 +1,24 @@ + +// Copyright Eric Niebler 2008 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: char.cpp 49240 2009-04-01 09:21:07Z eric_niebler $ +// $Date: 2009-04-01 02:21:07 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49240 $ + +#include +#include + +#include "integral_wrapper_test.hpp" + + +MPL_TEST_CASE() +{ +# define WRAPPER(T, i) char_ + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, char) +} Index: libs/mpl/test/Jamfile.v2 =================================================================== --- libs/mpl/test/Jamfile.v2 (revision 52087) +++ libs/mpl/test/Jamfile.v2 (working copy) @@ -44,6 +44,7 @@ compile insert.cpp ; compile insert_range.cpp ; run int.cpp ; +run char.cpp ; run integral_c.cpp : : : vacpp:-qchars=signed ; compile is_placeholder.cpp ; compile is_sequence.cpp ; @@ -90,3 +91,4 @@ compile vector.cpp ; compile vector_c.cpp ; compile zip_view.cpp ; +run string.cpp ; Index: libs/mpl/doc/src/refmanual/char_.rst =================================================================== --- libs/mpl/doc/src/refmanual/char_.rst (revision 0) +++ libs/mpl/doc/src/refmanual/char_.rst (revision 0) @@ -0,0 +1,89 @@ +.. Data Types/Numeric//char_ |60 + +.. Copyright Eric Niebler 2009. +.. 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) + +char\_ +====== + +Synopsis +-------- + +.. parsed-literal:: + + template< + char N + > + struct char\_ + { + // |unspecified| + // ... + }; + + +Description +----------- + +An |Integral Constant| wrapper for ``char``. + + +Header +------ + +.. parsed-literal:: + + #include + + +Model of +-------- + +|Integral Constant| + + +Parameters +---------- + ++---------------+-------------------------------+---------------------------+ +| Parameter | Requirement | Description | ++===============+===============================+===========================+ +| ``N`` | A character constant | A value to wrap. | ++---------------+-------------------------------+---------------------------+ + +Expression semantics +-------------------- + +|Semantics disclaimer...| |Integral Constant|. + +For arbitrary character constant ``c``: + ++-------------------+-----------------------------------------------------------+ +| Expression | Semantics | ++===================+===========================================================+ +| ``char_`` | An |Integral Constant| ``x`` such that ``x::value == c`` | +| | and ``x::value_type`` is identical to ``char``. | ++-------------------+-----------------------------------------------------------+ + + +Example +------- + +.. parsed-literal:: + + typedef char_<'c'> c; + + BOOST_MPL_ASSERT(( is_same< c::value_type, char > )); + BOOST_MPL_ASSERT(( is_same< c::type, c > )); + BOOST_MPL_ASSERT(( is_same< next< c >::type, char_<'d'> > )); + BOOST_MPL_ASSERT(( is_same< prior< c >::type, char_<'b'> > )); + BOOST_MPL_ASSERT_RELATION( (c::value), ==, 'c' ); + assert( c() == 'c' ); + + +See also +-------- + +|Data Types|, |Integral Constant|, |int_|, |size_t|, |integral_c| + Index: libs/mpl/doc/src/refmanual/string.rst =================================================================== --- libs/mpl/doc/src/refmanual/string.rst (revision 0) +++ libs/mpl/doc/src/refmanual/string.rst (revision 0) @@ -0,0 +1,140 @@ +.. Sequences/Classes//string |100 + +.. Copyright Eric Niebler 2009. +.. 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) + +string +====== + +Description +----------- + +``string`` is a |variadic|, `random access`__, `extensible`__ |Integral Sequence Wrapper| of +characters that supports constant-time insertion and removal of elements at both ends, and +linear-time insertion and removal of elements in the middle. The parameters to ``string`` +are multi-character literals, giving a somewhat readable syntax for compile-time strings. +``string`` also has a class static null-terminated character array called ``c_str`` that +facilitates interoperability with runtime string processing routines. + +__ `Random Access Sequence`_ +__ `Extensible Sequence`_ + +Header +------ + ++-------------------+-------------------------------------------------------+ +| Sequence form | Header | ++===================+=======================================================+ +| Variadic | ``#include `` | ++-------------------+-------------------------------------------------------+ + +Model of +-------- + +* |Integral Sequence Wrapper| +* |Variadic Sequence| +* |Random Access Sequence| +* |Extensible Sequence| +* |Back Extensible Sequence| +* |Front Extensible Sequence| + + +Expression semantics +-------------------- + +In the following table, ``s`` is an instance of ``string``, ``pos`` and ``last`` are iterators +into ``s``, ``r`` is a |Forward Sequence| of characters, ``n`` and ``x`` are |Integral Constant|\ s, +and |c1...cn| are arbitrary (multi-)characters. + ++---------------------------------------+-----------------------------------------------------------+ +| Expression | Semantics | ++=======================================+===========================================================+ +| .. parsed-literal:: | ``string`` of characters |c1...cn|; see | +| | |Variadic Sequence|. | +| string<|c1...cn|> | | ++---------------------------------------+-----------------------------------------------------------+ +| .. parsed-literal:: | Identical to ``string<``\ |c1...cn|\ ``>``; | +| | see |Variadic Sequence|. | +| string<|c1...cn|>::type | | ++---------------------------------------+-----------------------------------------------------------+ +| ``begin::type`` | An iterator pointing to the beginning of ``s``; | +| | see |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``end::type`` | An iterator pointing to the end of ``s``; | +| | see |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``size::type`` | The size of ``s``; see |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``empty::type`` | |true if and only if| the sequence is empty; | +| | see |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``front::type`` | The first element in ``s``; see | +| | |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``back::type`` | The last element in ``s``; see | +| | |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``at::type`` | The ``n``\ th element from the beginning of ``s``; see | +| | |Random Access Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``insert::type`` | A new ``string`` of following elements: | +| | [``begin::type``, ``pos``), ``x``, | +| | [``pos``, ``end::type``); see |Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``insert_range::type`` | A new ``string`` of following elements: | +| | [``begin::type``, ``pos``), | +| | [``begin::type``, ``end::type``) | +| | [``pos``, ``end::type``); see |Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``erase::type`` | A new ``string`` of following elements: | +| | [``begin::type``, ``pos``), | +| | [``next::type``, ``end::type``); see | +| | |Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``erase::type`` | A new ``string`` of following elements: | +| | [``begin::type``, ``pos``), | +| | [``last``, ``end::type``); see |Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``clear::type`` | An empty ``string``; see |Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``push_back::type`` | A new ``string`` of following elements: | +| | |begin/end|, ``x``; | +| | see |Back Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``pop_back::type`` | A new ``string`` of following elements: | +| | [``begin::type``, ``prior< end::type >::type``); | +| | see |Back Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``push_front::type`` | A new ``string`` of following elements: | +| | |begin/end|, ``x``; see |Front Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``pop_front::type`` | A new ``string`` of following elements: | +| | [``next< begin::type >::type``, ``end::type``); | +| | see |Front Extensible Sequence|. | ++---------------------------------------+-----------------------------------------------------------+ +| ``s::c_str`` | A null-terminated byte string such that | +| | ``s::c_str[``\ *n*\ ``]`` is | +| | ``at::type::value`` for each *n* in | +| | [``0``, ``size::type::value``), and | +| | ``s::c_str[size::type::value]`` is ``'\0'``. | ++---------------------------------------+-----------------------------------------------------------+ + + +Example +------- + +.. parsed-literal:: + + typedef string<'hell','o wo','rld'> hello; + typedef push_back >::type hello2; + + BOOST_ASSERT(0 == std::strcmp(hello2::c_str, "hello world!")); + + +See also +-------- + +|Sequences|, |Variadic Sequence|, |Random Access Sequence|, |Extensible Sequence|, |Integral Sequence Wrapper|, |char_| + Index: libs/mpl/doc/src/refmanual/IntegralConstant.rst =================================================================== --- libs/mpl/doc/src/refmanual/IntegralConstant.rst (revision 52087) +++ libs/mpl/doc/src/refmanual/IntegralConstant.rst (working copy) @@ -71,6 +71,7 @@ * |bool_| * |int_| * |long_| +* |char_| * |integral_c|