$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74007 - in sandbox/coerce: boost/coerce boost/coerce/detail libs/coerce/doc libs/coerce/doc/advanced
From: vexocide_at_[hidden]
Date: 2011-08-22 14:56:10
Author: vexocide
Date: 2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
New Revision: 74007
URL: http://svn.boost.org/trac/boost/changeset/74007
Log:
More documentation and renamed traits
Added:
   sandbox/coerce/libs/coerce/doc/acknowledgments.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/advanced_backend.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/advanced_interface.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/advanced_tags.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/tags_base.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/tags_precision.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_reserve_size.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_sequence.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_sequence_is_sequence.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_sequence_sequence_traits.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_string.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_string_is_char.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_string_is_string.qbk   (contents, props changed)
   sandbox/coerce/libs/coerce/doc/traits_string_string_traits.qbk   (contents, props changed)
Removed:
   sandbox/coerce/libs/coerce/doc/advanced/
Text files modified: 
   sandbox/coerce/boost/coerce/detail/karma.hpp |     8 +-                                      
   sandbox/coerce/boost/coerce/sequence.hpp     |    41 +++++++++-----                          
   sandbox/coerce/boost/coerce/string.hpp       |     6 -                                       
   sandbox/coerce/libs/coerce/doc/Jamroot       |     6 +-                                      
   sandbox/coerce/libs/coerce/doc/advanced.qbk  |     6 +-                                      
   sandbox/coerce/libs/coerce/doc/coerce.qbk    |     2                                         
   sandbox/coerce/libs/coerce/doc/tags.qbk      |   114 ++------------------------------------- 
   7 files changed, 47 insertions(+), 136 deletions(-)
Modified: sandbox/coerce/boost/coerce/detail/karma.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/detail/karma.hpp	(original)
+++ sandbox/coerce/boost/coerce/detail/karma.hpp	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -26,14 +26,16 @@
         template <typename Target, typename Source, typename Tag>
         static inline bool
         call(Target & target, Source const & source, Tag const & tag) {
+            typedef traits::sequence_traits<Target> sequence_traits;
+            
             detail::call_reserve(
                 target, traits::reserve_size<Source, Tag>::call(source, tag));
 
-            typename traits::sequence<Target>::type iterator =
-                traits::sequence<Target>::back_inserter(target);
+            typename sequence_traits::iterator iterator =
+                sequence_traits::back_inserter(target);
 
             typename Tag::template generator<
-                typename traits::sequence<Target>::type, Target, Source
+                typename sequence_traits::iterator, Target, Source
             > generator(tag);
 
             bool result = spirit::karma::generate(
Modified: sandbox/coerce/boost/coerce/sequence.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/sequence.hpp	(original)
+++ sandbox/coerce/boost/coerce/sequence.hpp	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -11,9 +11,7 @@
 #pragma once
 #endif
 
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/bool.hpp>
 
 #include <iterator>
 #include <string>
@@ -22,34 +20,47 @@
 namespace boost { namespace coerce { namespace traits {
 
     template <typename T>
-    struct sequence_impl
-        : mpl::identity<void> { };
+    struct sequence_traits_impl;
 
     template <typename T>
-    struct sequence_impl_std {
-        typedef std::back_insert_iterator<T> type;
+    struct sequence_traits_impl_std {
+        typedef std::back_insert_iterator<T> iterator;
 
-        static inline type
+        static inline iterator
         back_inserter(T & value) {
             return std::back_inserter(value);
         }
     };
 
     template <typename T, typename Traits, typename Allocator>
-    struct sequence_impl<std::basic_string<T, Traits, Allocator> >
-        : sequence_impl_std<std::basic_string<T, Traits, Allocator> > { };
+    struct sequence_traits_impl<std::basic_string<T, Traits, Allocator> >
+        : sequence_traits_impl_std<
+            std::basic_string<T, Traits, Allocator>
+        > { };
 
     template <typename T, typename Allocator>
-    struct sequence_impl<std::vector<T, Allocator> >
-        : sequence_impl_std<std::vector<T, Allocator> > { };
+    struct sequence_traits_impl<std::vector<T, Allocator> >
+        : sequence_traits_impl_std<std::vector<T, Allocator> > { };
 
     template <typename T, typename Enable = void>
-    struct sequence
-        : sequence_impl<T> { };
+    struct sequence_traits
+        : sequence_traits_impl<T> { };
 
     template <typename T>
+    struct is_sequence_impl
+        : mpl::false_ { };
+
+    template <typename T, typename Traits, typename Allocator>
+    struct is_sequence_impl<std::basic_string<T, Traits, Allocator> >
+        : mpl::true_ { };
+
+    template <typename T, typename Allocator>
+    struct is_sequence_impl<std::vector<T, Allocator> >
+        : mpl::true_ { };
+
+    template <typename T, typename Enable = void>
     struct is_sequence
-        : mpl::not_<is_same<typename sequence<T>::type, void> > { };
+        : is_sequence_impl<T> { };
 
 } } }  // namespace boost::coerce::traits
 
Modified: sandbox/coerce/boost/coerce/string.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/string.hpp	(original)
+++ sandbox/coerce/boost/coerce/string.hpp	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -9,9 +9,7 @@
 
 #include <boost/coerce/char.hpp>
 
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/bool.hpp>
 #include <boost/type_traits/remove_const.hpp>
 
 #include <cstddef>  // std::size_t
@@ -95,7 +93,7 @@
 
     template <typename T>
     struct is_string_impl
-        : mpl::identity<mpl::false_> { };
+        : mpl::false_ { };
 
     template <typename T>
     struct is_string_impl<T *>
Modified: sandbox/coerce/libs/coerce/doc/Jamroot
==============================================================================
--- sandbox/coerce/libs/coerce/doc/Jamroot	(original)
+++ sandbox/coerce/libs/coerce/doc/Jamroot	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -23,10 +23,10 @@
         <xsl:param>navig.graphics=1
         
         <xsl:param>chunk.first.sections=1
-        <xsl:param>chunk.section.depth=2
+        <xsl:param>chunk.section.depth=3
         # <xsl:param>generate.section.toc.level=4
-        # <xsl:param>toc.max.depth=3
-        # <xsl:param>toc.section.depth=3
+        <xsl:param>toc.max.depth=3
+        <xsl:param>toc.section.depth=3
 
         <dependency>css
         <dependency>png
Added: sandbox/coerce/libs/coerce/doc/acknowledgments.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/acknowledgments.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,34 @@
+[/
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Acknowledgments]
+
+First of all I'd like to thank the authors of Spirit, Harmut Kaiser and Joel de
+Guzman as well as everyone involved in the creation of this great library,
+without which this wouldn't have been possible.
+
+I'm very grateful to Google for the Google Summer of Code allowing me time to
+work on this project and Hartmut Kaiser in for mentoring me.
+
+A big thank you also goes out to Rudy Hardeman, for hosting a Hudson install
+with MSVC 10 allowing me to test my code using this compiler.
+
+Lastly a thank you to the whole Boost community, both on IRC and the
+mailinglist for advice, comments and critique. In particular:
+
+ * Michael Caisse
+ * Joel Falcou
+ * Thomas Heller
+ * Hartmut Kaiser
+ * Bryce Lelbach
+ * Leon Mergen
+ * Adam Merz
+ * Carl Philipp Reh
+ * Lars Viklund
+
+[endsect]
Modified: sandbox/coerce/libs/coerce/doc/advanced.qbk
==============================================================================
--- sandbox/coerce/libs/coerce/doc/advanced.qbk	(original)
+++ sandbox/coerce/libs/coerce/doc/advanced.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -8,8 +8,8 @@
 
 [section Advanced]
 
-[include advanced/backend.qbk]
-[include advanced/interface.qbk]
-[include advanced/tags.qbk]
+[include advanced_backend.qbk]
+[include advanced_interface.qbk]
+[include advanced_tags.qbk]
 
 [endsect]
Added: sandbox/coerce/libs/coerce/doc/advanced_backend.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/advanced_backend.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,132 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Backend]
+
+By default Coerce relies on Spirit but it is possible to implement your own conversion backends.
+
+[heading Namespace]
+
+For `as`:
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <
+        typename Target,
+        typename Source,
+        typename Tag,
+        typename Enable = void
+    >
+    struct as
+    {
+        typedef <see below> type;
+    };
+
+
+where type is of:
+
+    struct <unspecified> {
+        template <typename Target, typename Source, typename Tag>
+        static bool
+        call(Target &, Source const &, Tag const &);
+    };
+
+[heading Template parameters]
+
+[table
+    [[Parameter] [Description] [Default]]
+    [[`Target`] [The target type.] [None]]
+    [[`Source`] [The source type.] [None]]
+    [[`Tag`] [A tag type.]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `transform_attribute` utilizing SFINAE
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`Target`] [An arbitrary type.]]
+    [[`target`] [An instance of `Target`.]]
+    [[`Source`] [An arbitrary type.]]
+    [[`source`] [An instance of `Source`.]]
+    [[`Tag`] [A tag type.]]
+    [[`tag`] [An instance of `Tag`.]]
+]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`as<Target, Source, Tag>::type`]
+        [The type of an interface, please see __advanced_interface__.]
+    ]
+    [
+        [`<unspecified>::template call<Target, Source, Tag>(target, source, tag)`]
+        [A function to convert `source` to `target` with the possible help of
+            `tag`, returning whether it was successful.]
+    ]
+]
+
+[heading Predefined specializations]
+
+Coerce dispatches the conversion to either Qi or Karma by default, depending on
+the Target and Source types.
+
+[heading Example]
+
+    #include <boost/coerce.hpp>
+
+    #include <cctype>  // for std::isspace
+    #include <cerrno>  // for errno
+    #include <cstdio>  // for std::strtol
+    #include <iostream>
+
+    struct strtol {
+        template <typename Target, typename Source, typename Tag>
+        static inline bool
+        call(Target & target, Source const & source, Tag const &) {
+            char *end;
+        
+            if (std::isspace(*source)) {
+                return false;
+            }
+
+            errno = 0;
+            target = std::strtol(source, &end, 10);
+
+            if (errno != 0 || *end != 0 || source == end) {
+                return false;
+            }
+
+            return true;
+        }
+    };
+
+    namespace boost { namespace coerce { namespace traits {
+
+        template <std::size_t N>
+        struct as<long int, char [N], tag::none>
+            : strtol { };
+
+    } } }  // namespace boost::coerce::traits
+
+    int
+    main() {
+        using namespace boost;
+
+        std::cout << coerce::as<long int>("23") << std::endl;
+    }
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/advanced_interface.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/advanced_interface.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,56 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Interface]
+
+As described in the synopsis Coerce has the functions `as` and `as_default`,
+but many others were proposed on the Boost mailinglist whilst discussing
+possible interface. Whilst I believe the two functions cover all cases it is
+possible to extend Coerce with your own functions based on the interface
+described in __advanced__backend__.
+
+If no tag is specified default to `boost::coerce::tag::none`.
+
+[heading Example]
+
+    #include <boost/coerce.hpp>
+
+    #include <iostream>
+    #include <string>
+    #include <utility>
+
+    template <typename Target, typename Source, typename Tag>
+    inline std::pair<Target, bool>
+    as_pair(Source const & source, Tag const & tag) {
+        Target target;
+
+        bool result = boost::coerce::traits::as<
+                Target, Source, Tag
+            >::template call<Target, Source, Tag>(
+                target, source, tag);
+
+        return std::make_pair(target, result);
+    }
+
+    template <typename Target, typename Source>
+    inline std::pair<Target, bool>
+    as_pair(Source const & source) {
+        return as_pair<Target, Source, boost::coerce::tag::none>(
+            source, boost::coerce::tag::none());
+    }
+
+    int
+    main() {
+        std::pair<int, bool> result = as_pair<int>("23");
+
+        if (result.second) {
+            std::cout << result.first << std::endl;
+        }
+    }
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/advanced_tags.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/advanced_tags.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,13 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Tags]
+
+TODO
+
+[endsect]
Modified: sandbox/coerce/libs/coerce/doc/coerce.qbk
==============================================================================
--- sandbox/coerce/libs/coerce/doc/coerce.qbk	(original)
+++ sandbox/coerce/libs/coerce/doc/coerce.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -22,3 +22,5 @@
 [include synopsis.qbk]
 [include tags.qbk]
 [include advanced.qbk]
+[include traits.qbk]
+[include acknowledgments.qbk]
Modified: sandbox/coerce/libs/coerce/doc/tags.qbk
==============================================================================
--- sandbox/coerce/libs/coerce/doc/tags.qbk	(original)
+++ sandbox/coerce/libs/coerce/doc/tags.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -14,7 +14,10 @@
 
 [heading Namespace]
 
-    namespace boost::coerce::tag
+[table
+    [[Name]]
+    [[`boost::coerce::tags`]]
+]
 
 [heading Example]
 
@@ -33,112 +36,7 @@
         return 0;
     }
 
-[section Base]
-
-[heading Description]
-
-Parse or generate an integer number with a base other than ten.
-
-[heading Header]
-
-    #include boost/coerce/tag/base.hpp
-
-[heading Synopsis]
-
-    template <unsigned N>
-    struct base { };
-
-    struct hex
-        : base<16> { };
-
-    struct oct
-        : base<8> { };
-
-    struct bin
-        : base<2> { };
-
-[heading String to type]
-
-This will parse an integer (either signed or unsigned) using radix 2 for `bin`,
-8 for `oct`, 16 for `hex` or any radix between 2 and 36 for base<N>. The `hex`
-parser will accept an optional prefix of "0x" or "0X", the other don't accept
-any prefixes.
-
-Using this conversion with a non-integer type will lead to a static assertion.
-
-[heading Type to string]
-
-This will generate a string representation of an integer (either signed or 
-unsigned) using radix 2 for `bin`, 8 for `oct`, 16 for `hex` or any radix 
-between 2 and 36 for base<N>. No prefix is generated.
-
-Using this conversion with a non-integral type will lead to a static assertion.
-
-[heading Example]
-
-    #include <boost/coerce.hpp>
-    #include <boost/coerce/tag/base.hpp>
-
-    int
-    main() {
-        using namespace boost;
-
-        int i = coerce::as<int>("0x23", coerce::tag::hex());
-
-        return 0;
-    }
-
-This will parse the input of "0x23" and assign 35 to `i`.
-
-[endsect]
-
-[section Precision]
-
-[heading Description]
-
-Specify the decimal precision to be used when generating floating point types,
-it is similar to `std::setprecision`.
-
-[heading Header]
-
-    #include boost/coerce/tag/precision.hpp
-
-[heading Synopsis]
-
-    struct precision {
-        precision(unsigned const &);
-    }
-
-[heading String to type]
-
-Not applicable, a static assertion will be trigger upon use.
-
-[heading Type to string]
-
-This will generate a string representation of a floating point type rounded to
-the specified number of decimals.
-
-Using this conversion with a non-floating point type will lead to a static assertion.
-
-[heading Example]
-
-        #include <boost/coerce.hpp>
-        #include <boost/coerce/tag/precision.hpp>
-
-        #include <string>
-
-        int
-        main() {
-            using namespace boost;
-
-            std::string s = coerce::as<std::string>(1.0182818L, coerce::tag::precision(2));
-
-            return 0;
-        }
-
-This will cause 1.0182818 to be rounded to 2 decimals when generated, resulting
-in the string "1.02".
-
-[endsect]
+[include tags_base.qbk]
+[include tags_precision.qbk]
 
 [endsect]
Added: sandbox/coerce/libs/coerce/doc/tags_base.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/tags_base.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,66 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Base]
+
+[heading Description]
+
+Parse or generate an integer number with a base other than ten.
+
+[heading Header]
+
+    #include boost/coerce/tag/base.hpp
+
+[heading Synopsis]
+
+    template <unsigned N>
+    struct base { };
+
+    struct hex
+        : base<16> { };
+
+    struct oct
+        : base<8> { };
+
+    struct bin
+        : base<2> { };
+
+[heading String to type]
+
+This will parse an integer (either signed or unsigned) using radix 2 for `bin`,
+8 for `oct`, 16 for `hex` or any radix between 2 and 36 for base<N>. The `hex`
+parser will accept an optional prefix of "0x" or "0X", the other don't accept
+any prefixes.
+
+Using this conversion with a non-integer type will lead to a static assertion.
+
+[heading Type to string]
+
+This will generate a string representation of an integer (either signed or 
+unsigned) using radix 2 for `bin`, 8 for `oct`, 16 for `hex` or any radix 
+between 2 and 36 for base<N>. No prefix is generated.
+
+Using this conversion with a non-integral type will lead to a static assertion.
+
+[heading Example]
+
+    #include <boost/coerce.hpp>
+    #include <boost/coerce/tag/base.hpp>
+
+    int
+    main() {
+        using namespace boost;
+
+        int i = coerce::as<int>("0x23", coerce::tag::hex());
+
+        return 0;
+    }
+
+This will parse the input of "0x23" and assign 35 to `i`.
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/tags_precision.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/tags_precision.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,56 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Precision]
+
+[heading Description]
+
+Specify the decimal precision to be used when generating floating point types,
+it is similar to `std::setprecision`.
+
+[heading Header]
+
+    #include boost/coerce/tag/precision.hpp
+
+[heading Synopsis]
+
+    struct precision {
+        precision(unsigned const &);
+    }
+
+[heading String to type]
+
+Not applicable, a static assertion will be trigger upon use.
+
+[heading Type to string]
+
+This will generate a string representation of a floating point type rounded to
+the specified number of decimals.
+
+Using this conversion with a non-floating point type will lead to a static assertion.
+
+[heading Example]
+
+        #include <boost/coerce.hpp>
+        #include <boost/coerce/tag/precision.hpp>
+
+        #include <string>
+
+        int
+        main() {
+            using namespace boost;
+
+            std::string s = coerce::as<std::string>(1.0182818L, coerce::tag::precision(2));
+
+            return 0;
+        }
+
+This will cause 1.0182818 to be rounded to 2 decimals when generated, resulting
+in the string "1.02".
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,15 @@
+[/
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Traits]
+
+[include traits_sequence.qbk]
+[include traits_string.qbk]
+[include traits_reserve_size.qbk]
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_reserve_size.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_reserve_size.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,105 @@
+[section reserve_size]
+
+[heading Description]
+
+`reserve_size` is a metafunction to determine the amount of space to reserve in a sequence.
+
+[heading Namespace]
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <typename T, typename Tag, typename Enable>
+    struct reserve_size {
+        static std::size_t call(T const &, Tag const &);
+    };
+
+[heading Template parameters]
+[table
+    [[Parameter] [Description] [Default]]
+    [[`T`] [An arbitrary type.] [None]]
+    [[`Tag`] [A tag type.] [None]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `reserve_size` utilizing SFINAE 
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`T`] [An arbitrary type.]]
+    [[`t`] [An instance of `T`.]]
+    [[`Tag`] [A tag type.]]
+    [[`tag`] [An instance of `Tag`.]]
+    [[`Radix`] [An unsigned integer between 2 and 36.]]
+]
+
+[heading Expression semantics]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`reserve_size<T, Tag>::call(t, tag)`]
+        [The amount of space to reserve in a string sequence when generating a
+            string representation of t.]
+    ]
+]
+
+[heading Predefined specializations]
+
+[table
+    [[Type] [Tag] [Semantics]]
+    [[`T`] [`Tag`] [0]]
+    [[`T const`] [`Tag`] [`T`]]
+    [[`char`] [`Tag`] [1]]
+    [[`wchar_t`] [`Tag`] [1]]
+    [
+        [`int`]
+        [`Tag`]
+        [`std::numeric_limits<int>::is_signed` + 1 +
+            `std::numeric_limits<int>::digits10`]
+    ]
+    [
+        [`int`]
+        [`tag::base<Radix>`]
+        [1 + `std::numeric_limits<int>::digits / static_log2<Radix>::value`]
+    ]
+    [[`int`] [`tag::bin`] [1 + `std::numeric_limits<int>::digits`]]
+    [[`int`] [`tag::oct`] [1 + `std::numeric_limits<int>::digits / 3`]]
+    [[`int`] [`tag::hex`] [1 + `std::numeric_limits<int>::digits / 4`]]
+    [[`short`] [] [Similar to `int`]]
+    [[`long`] [] [Similar to `int`]]
+    [[`unsigned int`] [] [Similar to `int`]]
+    [[`unsigned short`] [] [Similar to `int`]]
+    [[`unsigned long`] [] [Similar to `int`]]
+    [[`boost::long_long_type`] [] [Similar to `int`]]
+    [[`boost::ulong_long_type`] [] [Similar to `int`]]
+    [
+        [`float`]
+        [`Tag`]
+        [`std::numeric_limits<float>::is_signed` + 8 +
+            `detail::precision<float>::value`]
+    ]
+    [[`double`] [] [Similar to `float`]]
+    [[`long double`] [] [Similar to `float`]]
+    [[`bool`] [`Tag`] [5]]
+    [[`boost::optional<T>`] [`Tag`] [`T`]]
+]
+
+[heading Example]
+
+    template <typename T>
+    struct reserve_size<T, tag::hex> {
+        static std::size_t
+        call(T const &, tag::hex const &) {
+            return 2 + std::numeric_limits<unsigned int>::digits / 4;
+        }
+    };
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_sequence.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_sequence.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,14 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section Sequence]
+
+[include traits_sequence_is_sequence.qbk]
+[include traits_sequence_sequence_traits.qbk]
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_sequence_is_sequence.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_sequence_is_sequence.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,81 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section is_sequence]
+
+[heading Description]
+
+`is_sequence` is a metafunction that detects if a given type is a sequence.
+
+[caution `is_sequence<T>` requires `back_inserter<T>` to be specialized.]
+
+[heading Namespace]
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <typename T, typename Enable>
+    struct is_sequence
+    {
+        <unspecified>;
+    };
+
+[heading Template parameters]
+
+[table
+    [[Parameter] [Description] [Default]]
+    [[`T`] [The type to detect.] [None]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `transform_attribute` utilizing SFINAE
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`T`] [An arbitrary type.]]
+    [[`Traits`] [A character traits type.]]
+    [[`Allocator`] [A standard allocator type.]]
+]
+
+
+[heading Expression semantics]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`is_sequence<T>::type`]
+        [`mpl::true_` if T should be treated as a character type, and
+            `mpl::false_` otherwise. Generally, any implementation of
+            `is_sequence` needs to behave as if if was a
+            __mpl_boolean_constant__.]
+    ]
+]
+
+[heading Predefined specializations]
+
+[table
+    [[Type] [Semantics]]
+    [[`T`] [`mpl::false_`]]
+    [[`std::basic_string<T, Traits, Allocator>`] [`mpl::true_`]]
+    [[`std::vector<T, Allocator>`] [`mpl::true_`]]
+]
+
+[heading Example]
+
+    template <typename T, typename Traits, typename Allocator>
+    struct is_sequence<std::basic_string<T, Traits, Allocator> >
+        : mpl::true_ { };
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_sequence_sequence_traits.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_sequence_sequence_traits.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,74 @@
+[section sequence_traits]
+
+[heading Namespace]
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <typename T, typename Enable>
+    struct sequence_traits {
+        typedef <unspecified> iterator;
+
+        static iterator back_inserter(T &);
+    };
+
+[heading Template parameters]
+[table
+    [[Parameter] [Description] [Default]]
+    [[`T`] [An arbitrary type.] [None]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `back_inserter` utilizing SFINAE 
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`T`] [An arbitrary type.]]
+    [[`t`] [An instance of `T`.]]
+    [[`Traits`] [A character traits type.]]
+    [[`Allocator`] [A standard allocator type.]]
+]
+
+[heading Expression semantics]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`sequence_traits<T>::iterator`]
+        [Evaluates to the return type of `sequence_traits<T>::back_inserter(t)`
+            and is a back insert iterator type.]
+    ]
+    [
+        [`sequence_traits<T>::back_inserter(t)`]
+        [Returns a back insert iterator for `t`]
+    ]
+]
+
+[heading Predefined specializations]
+
+[table
+    [[Type] [Semantics]]
+    [[`std::basic_string<T, Traits, Allocator>`] []]
+    [[`std::vector<T, Allocator>`] []]
+]
+
+[heading Example]
+
+    template <typename T, typename Traits, typename Allocator>
+    struct sequence_traits {
+        typedef std::back_insert_iterator<std::basic_string<T, Traits, Allocator> > iterator;
+    
+        static inline iterator
+        back_inserter(std::basic_string<T, Traits, Allocator> & value) {
+            return std::back_inserter(value);
+        }
+    };
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_string.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_string.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,15 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section String]
+
+[include traits_string_is_char.qbk]
+[include traits_string_is_string.qbk]
+[include traits_string_string_traits.qbk]
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_string_is_char.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_string_is_char.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,76 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section is_char]
+
+[heading Description]
+
+`is_char` is a metafunction that detects if a given type is a character.
+
+[heading Namespace]
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <typename T, typename Enable>
+    struct is_char
+    {
+        <unspecified>;
+    };
+
+[heading Template parameters]
+
+[table
+    [[Parameter] [Description] [Default]]
+    [[`T`] [The type to detect.] [None]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `transform_attribute` utilizing SFINAE
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`T`] [An arbitrary type.]]
+]
+
+[heading Expression semantics]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`is_char<T>::type`]
+        [`mpl::true_` if T should be treated as a character type, and
+            `mpl::false_` otherwise. Generally, any implementation of `is_char`
+            needs to behave as if if was a __mpl_boolean_constant__.]
+    ]
+]
+
+[heading Predefined specializations]
+
+[table
+    [[Type] [Semantics]]
+    [[`T`] [`mpl::false_`]]
+    [[`T const`] [`is_char<T>`]]
+    [[`char`] [`mpl::true_`]]
+    [[`wchar_t`] [`mpl::true_`]]
+]
+
+[heading Example]
+
+    template <>
+    struct is_char<char>
+        : mpl::true_ { };
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_string_is_string.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_string_is_string.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,84 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section is_string]
+
+[heading Description]
+
+`is_string` is a metafunction that detects if a given type is a string.
+
+[caution `is_string<T>` requires `string_traits<T>` to be specialized.]
+
+[heading Namespace]
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <typename T, typename Enable>
+    struct is_string
+    {
+        <unspecified>;
+    };
+
+[heading Template parameters]
+
+[table
+    [[Parameter] [Description] [Default]]
+    [[`T`] [The type to detect.] [None]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `transform_attribute` utilizing SFINAE
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`T`] [An arbitrary type.]]
+    [[`N`] [An arbitrary integral constant.]]
+    [[`Char`] [A character type as defined by __traits_is_char__.]]
+    [[`Traits`] [A character traits type.]]
+    [[`Allocator`] [A standard allocator type.]]
+]
+
+[heading Expression semantics]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`is_string<T>::type`]
+        [`mpl::true_` if T should be treated as a string type, and
+            `mpl::false_` otherwise. Generally, any implementation of
+            `is_string` needs to behave as if if was a
+            __mpl_boolean_constant__.]
+    ]
+]
+
+[heading Predefined specializations]
+
+[table
+    [[Type] [Semantics]]
+    [[`T`] [`mpl::false_`]]
+    [[`T const`] [`is_string<T>`]]
+    [[`Char *`] [`mpl::true_`]]
+    [[`Char [N]`] [`mpl::true_`]]
+    [[`std::basic_string<Char, Traits, Allocator>`] [`mpl::true_`]]
+]
+
+[heading Example]
+
+    template <typename Char, typename Traits, typename Allocator>
+    struct is_string<std::basic_string<Char, Traits, Allocator> >
+        : mpl::true_ { };
+
+[endsect]
Added: sandbox/coerce/libs/coerce/doc/traits_string_string_traits.qbk
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/doc/traits_string_string_traits.qbk	2011-08-22 14:56:08 EDT (Mon, 22 Aug 2011)
@@ -0,0 +1,114 @@
+[/              
+                Copyright Jeroen Habraken 2011.
+
+   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)
+]
+
+[section string_traits]
+
+[heading Namespace]
+
+[table
+    [[Name]]
+    [[`boost::coerce::traits`]]
+]
+
+[heading Synopsis]
+
+    template <typename T, typename Enable>
+    struct string_traits {
+        typedef <unspecified> const_iterator;
+        typedef <unspecified> size_type;
+
+        static const_iterator begin(T const &);
+        static const_iterator end(T const &);
+        static size_type length(T const &);
+    };
+
+
+[heading Template parameters]
+
+[table
+    [[Parameter] [Description] [Default]]
+    [[`T`] [The type.] [None]]
+    [
+        [`Enable`]
+        [Helper template parameter usable to selectively enable or disable
+            certain specializations of `string_traits` utilizing SFINAE
+            (i.e. `boost::enable_if` or `boost::disable_if`).]
+        [`void`]
+    ]
+]
+
+[variablelist Notation
+    [[`T`] [An arbitrary type.]]
+    [[`t`] [An instance of `T`.]]
+    [[`N`] [An arbitrary integral constant.]]
+    [[`Char`] [A character type as defined by __traits_is_char__.]]
+    [[`Traits`] [A character traits type.]]
+    [[`Allocator`] [A standard allocator type.]]
+]
+
+[heading Expression semantics]
+
+[table
+    [[Expression] [Semantics]]
+    [
+        [`string<T>::const_iterator`]
+        [Evaluates to the return type of `string<T>::begin(t)` and `string<T>::end(t)`.]
+    ]
+    [
+        [`string<T>::size_type`]
+        [Evaluates to the return type of `string<T>::length(t)`.]
+    ]
+    [
+        [`string<T>::begin(t)`]
+        [Returns a `const_iterator` pointing to the beginning of the string.]
+    ]
+    [
+        [`string<T>::end(t)`]
+        [Returns a `const_iterator` pointing to the end of the string.]
+    ]
+    [
+        [`string<T>::length(t)`] [Returns the length of the string.]
+    ]
+]
+
+[heading Predefined specializations]
+
+[table
+    [[Type] [Semantics]]
+    [[`T const`] [`T`]]
+    [[`Char *`] []]
+    [[`Char [N]`] []]
+    [[`std::basic_string<Char, Traits, Allocator>`] []]
+]
+
+[heading Example]
+
+    template <typename Char, typename Traits, typename Allocator>
+    struct string_traits<std::basic_string<Char, Traits, Allocator> > {
+        typedef std::basic_string<Char, Traits, Allocator> type;
+
+        typedef typename type::const_iterator const_iterator;
+        typedef typename type::size_type size_type;
+
+        static const_iterator
+        begin(type const & value) {
+            return value.begin();
+        }
+
+        static const_iterator
+        end(type const & value) {
+            return value.end();
+        }
+
+        static size_type
+        length(type const & value) {
+            return value.length();
+        }
+    };
+
+[endsect]