Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52317 - in trunk: boost/mpl boost/mpl/limits libs/mpl/doc/src/refmanual
From: eric_at_[hidden]
Date: 2009-04-11 02:30:54


Author: eric_niebler
Date: 2009-04-11 02:30:53 EDT (Sat, 11 Apr 2009)
New Revision: 52317
URL: http://svn.boost.org/trac/boost/changeset/52317

Log:
add and document BOOST_MPL_LIMIT_STRING_SIZE and mpl/limits/string.hpp
Added:
   trunk/boost/mpl/limits/string.hpp (contents, props changed)
   trunk/libs/mpl/doc/src/refmanual/LIMIT_STRING_SIZE.rst (contents, props changed)
Text files modified:
   trunk/boost/mpl/string.hpp | 16 +++++++---------
   trunk/libs/mpl/doc/src/refmanual/string.rst | 4 ++--
   2 files changed, 9 insertions(+), 11 deletions(-)

Added: trunk/boost/mpl/limits/string.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/mpl/limits/string.hpp 2009-04-11 02:30:53 EDT (Sat, 11 Apr 2009)
@@ -0,0 +1,21 @@
+
+#ifndef BOOST_MPL_LIMITS_STRING_HPP_INCLUDED
+#define BOOST_MPL_LIMITS_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 $
+
+#if !defined(BOOST_MPL_LIMIT_STRING_SIZE)
+# define BOOST_MPL_LIMIT_STRING_SIZE 32
+#endif
+
+#endif // BOOST_MPL_LIMITS_STRING_HPP_INCLUDED

Modified: trunk/boost/mpl/string.hpp
==============================================================================
--- trunk/boost/mpl/string.hpp (original)
+++ trunk/boost/mpl/string.hpp 2009-04-11 02:30:53 EDT (Sat, 11 Apr 2009)
@@ -14,11 +14,13 @@
 // $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $
 // $Revision: 49239 $
 
+#include <boost/mpl/limits/string.hpp>
 #include <boost/mpl/char.hpp>
 #include <boost/mpl/copy.hpp>
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/size_t.hpp>
+#include <boost/mpl/begin_end.hpp>
 #include <boost/mpl/joint_view.hpp>
 #include <boost/mpl/insert_range.hpp>
 #include <boost/mpl/back_inserter.hpp>
@@ -37,11 +39,7 @@
 
 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_STRING_MAX_PARAMS BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_LIMIT_STRING_SIZE, 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))))
@@ -135,7 +133,7 @@
         struct apply
         {
             BOOST_MPL_ASSERT_MSG(
- (BOOST_MPL_STRING_MAX_LENGTH != mpl::size<Sequence>::type::value)
+ (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)
               , PUSH_BACK_FAILED_MPL_STRING_IS_FULL
               , (Sequence)
             );
@@ -228,7 +226,7 @@
         struct apply
         {
             BOOST_MPL_ASSERT_MSG(
- (BOOST_MPL_STRING_MAX_LENGTH != mpl::size<Sequence>::type::value)
+ (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)
               , PUSH_FRONT_FAILED_MPL_STRING_IS_FULL
               , (Sequence)
             );
@@ -479,7 +477,7 @@
         typedef \
             typename mpl::aux_::next_unless<BOOST_PP_CAT(i, n), iend>::type \
         BOOST_PP_CAT(i, BOOST_PP_INC(n));
- BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_LENGTH, M0, ~)
+ BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
         #undef M0
 
         typedef c_str type;
@@ -491,7 +489,7 @@
     {
         #define M0(z, n, data) \
         mpl::aux_::deref_unless<BOOST_PP_CAT(i, n), iend>::type::value,
- BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_LENGTH, M0, ~)
+ BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
         #undef M0
         '\0'
     };

Added: trunk/libs/mpl/doc/src/refmanual/LIMIT_STRING_SIZE.rst
==============================================================================
--- (empty file)
+++ trunk/libs/mpl/doc/src/refmanual/LIMIT_STRING_SIZE.rst 2009-04-11 02:30:53 EDT (Sat, 11 Apr 2009)
@@ -0,0 +1,52 @@
+.. Macros/Configuration//BOOST_MPL_LIMIT_STRING_SIZE |65
+
+.. 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)
+
+BOOST_MPL_LIMIT_STRING_SIZE
+===========================
+
+Synopsis
+--------
+
+.. parsed-literal::
+
+ #if !defined(BOOST_MPL_LIMIT_STRING_SIZE)
+ # define BOOST_MPL_LIMIT_STRING_SIZE \\
+ |idic| \\
+ /\*\*/
+ #endif
+
+
+Description
+-----------
+
+``BOOST_MPL_LIMIT_STRING_SIZE`` is an overridable configuration macro regulating
+the maximum arity of the ``string``\ 's |variadic forms|. In this
+implementation of the library, ``BOOST_MPL_LIMIT_STRING_SIZE`` has a default value
+of 32. To override the default limit, define ``BOOST_MPL_LIMIT_STRING_SIZE`` to
+the desired maximum arity before including any library header.
+
+
+Example
+-------
+
+.. parsed-literal::
+
+ #define BOOST_MPL_LIMIT_STRING_SIZE 8
+ ``#``\ include <boost/mpl/string.hpp>
+
+ using namespace boost::mpl;
+
+ typedef string<'a'> s_1;
+ typedef string<'abcd','efgh'> s_8;
+ // typedef string<'abcd','efgh','i'> s_9; // error!
+
+
+See also
+--------
+
+|Configuration|, |BOOST_MPL_LIMIT_VECTOR_SIZE|
+

Modified: trunk/libs/mpl/doc/src/refmanual/string.rst
==============================================================================
--- trunk/libs/mpl/doc/src/refmanual/string.rst (original)
+++ trunk/libs/mpl/doc/src/refmanual/string.rst 2009-04-11 02:30:53 EDT (Sat, 11 Apr 2009)
@@ -12,8 +12,8 @@
 -----------
 
 ``string`` is a |variadic|, `bidirectional`__, `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``
+characters that supports amortized 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`` can also be an argument to the ``c_str`` metafunction, which generates a
 null-terminated character array that facilitates interoperability with runtime string


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk