From 0faf16666f94e0604665fcf46805accd7187b64a Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Thu, 9 Nov 2006 06:36:04 +0000 Subject: [PATCH] segmented_size, for calculating the size of any segmented data structure [SVN r35945] --- .../fusion/sequence/intrinsic/ext_/size_s.hpp | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp diff --git a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp b/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp new file mode 100755 index 00000000..4fbb58d1 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp @@ -0,0 +1,55 @@ +/*============================================================================= + Copyright (c) 2006 Eric Niebler + + Use, modification and distribution is subject to 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) +==============================================================================*/ +#if !defined(FUSION_SIZE_S_08112006_1141) +#define FUSION_SIZE_S_08112006_1141 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + /////////////////////////////////////////////////////////////////////////// + // calculates the size of any segmented data structure. + template::value> + struct segmented_size; + + namespace detail + { + struct size_plus + { + template + struct result + : mpl::plus< + segmented_size::type> + , State + > + {}; + }; + } + + /////////////////////////////////////////////////////////////////////////// + template + struct segmented_size + : result_of::fold< + typename result_of::segments::type + , mpl::size_t<0> + , detail::size_plus + >::type + {}; + + template + struct segmented_size + : result_of::size + {}; +}} + +#endif