Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67465 - in trunk: boost/proto boost/proto/functional boost/proto/functional/fusion libs/proto/doc libs/proto/doc/reference/functional/fusion
From: eric_at_[hidden]
Date: 2010-12-26 23:04:08


Author: eric_niebler
Date: 2010-12-26 23:03:56 EST (Sun, 26 Dec 2010)
New Revision: 67465
URL: http://svn.boost.org/trac/boost/changeset/67465

Log:
add Proto callable for fusion::at
Added:
   trunk/boost/proto/functional/fusion/at.hpp (contents, props changed)
   trunk/libs/proto/doc/reference/functional/fusion/at.xml (contents, props changed)
Text files modified:
   trunk/boost/proto/functional/fusion.hpp | 1 +
   trunk/boost/proto/proto_fwd.hpp | 2 ++
   trunk/libs/proto/doc/reference.xml | 6 ++++++
   3 files changed, 9 insertions(+), 0 deletions(-)

Modified: trunk/boost/proto/functional/fusion.hpp
==============================================================================
--- trunk/boost/proto/functional/fusion.hpp (original)
+++ trunk/boost/proto/functional/fusion.hpp 2010-12-26 23:03:56 EST (Sun, 26 Dec 2010)
@@ -9,6 +9,7 @@
 #ifndef BOOST_PROTO_FUNCTIONAL_FUSION_HPP_EAN_11_27_2010
 #define BOOST_PROTO_FUNCTIONAL_FUSION_HPP_EAN_11_27_2010
 
+#include <boost/proto/functional/fusion/at.hpp>
 #include <boost/proto/functional/fusion/pop_back.hpp>
 #include <boost/proto/functional/fusion/pop_front.hpp>
 #include <boost/proto/functional/fusion/push_back.hpp>

Added: trunk/boost/proto/functional/fusion/at.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/proto/functional/fusion/at.hpp 2010-12-26 23:03:56 EST (Sun, 26 Dec 2010)
@@ -0,0 +1,56 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file at.hpp
+/// Proto callables Fusion at
+//
+// Copyright 2010 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_PROTO_FUNCTIONAL_FUSION_AT_HPP_EAN_11_27_2010
+#define BOOST_PROTO_FUNCTIONAL_FUSION_AT_HPP_EAN_11_27_2010
+
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/proto/proto_fwd.hpp>
+
+namespace boost { namespace proto { namespace functional
+{
+ /// \brief A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::at() accessor on its argument.
+ ///
+ /// A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::at() accessor on its argument.
+ struct at
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Seq, typename N>
+ struct result<This(Seq, N)>
+ : fusion::result_of::at<
+ typename boost::remove_reference<Seq>::type
+ , typename boost::remove_const<typename boost::remove_reference<N>::type>::type
+ >
+ {};
+
+ template<typename Seq, typename N>
+ typename fusion::result_of::at<Seq, N>::type
+ operator ()(Seq &seq, N const & BOOST_PROTO_DISABLE_IF_IS_CONST(Seq)) const
+ {
+ return fusion::at<N>(seq);
+ }
+
+ template<typename Seq, typename N>
+ typename fusion::result_of::at<Seq const, N>::type
+ operator ()(Seq const &seq, N const &) const
+ {
+ return fusion::at<N>(seq);
+ }
+ };
+}}}
+
+#endif

Modified: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp (original)
+++ trunk/boost/proto/proto_fwd.hpp 2010-12-26 23:03:56 EST (Sun, 26 Dec 2010)
@@ -584,6 +584,7 @@
         struct make_pair;
         struct first;
         struct second;
+ struct at;
         struct pop_front;
         struct push_front;
         struct pop_back;
@@ -595,6 +596,7 @@
     typedef functional::make_pair _make_pair;
     typedef functional::first _first;
     typedef functional::second _second;
+ typedef functional::pop_front _at;
     typedef functional::pop_front _pop_front;
     typedef functional::push_front _push_front;
     typedef functional::pop_back _pop_back;

Modified: trunk/libs/proto/doc/reference.xml
==============================================================================
--- trunk/libs/proto/doc/reference.xml (original)
+++ trunk/libs/proto/doc/reference.xml 2010-12-26 23:03:56 EST (Sun, 26 Dec 2010)
@@ -292,6 +292,11 @@
       </listitem>
       <listitem>
         <computeroutput>
+ <classname alt="boost::proto::functional::at">proto::functional::at</classname>
+ </computeroutput>
+ </listitem>
+ <listitem>
+ <computeroutput>
           <classname alt="boost::proto::functional::child">proto::functional::child</classname>
         </computeroutput>
       </listitem>
@@ -1105,6 +1110,7 @@
   <xi:include href="reference/extends.xml"/>
   <xi:include href="reference/functional.xml"/>
   <xi:include href="reference/functional/fusion.xml"/>
+ <xi:include href="reference/functional/fusion/at.xml"/>
   <xi:include href="reference/functional/fusion/pop_back.xml"/>
   <xi:include href="reference/functional/fusion/pop_front.xml"/>
   <xi:include href="reference/functional/fusion/push_back.xml"/>

Added: trunk/libs/proto/doc/reference/functional/fusion/at.xml
==============================================================================
--- (empty file)
+++ trunk/libs/proto/doc/reference/functional/fusion/at.xml 2010-12-26 23:03:56 EST (Sun, 26 Dec 2010)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<header name="boost/proto/functional/fusion/at.hpp">
+ <para>Includes Proto callable <computeroutput><classname>boost::proto::functional::at</classname></computeroutput>.</para>
+
+ <namespace name="boost">
+ <namespace name="proto">
+ <namespace name="functional">
+
+ <!-- proto::functional::at -->
+ <struct name="at">
+ <purpose>A <conceptname>PolymorphicFunctionObject</conceptname> type that invokes the
+ <computeroutput>fusion::at()</computeroutput> accessor function on its arguments.</purpose>
+ <description>
+ <para>
+ A <conceptname>PolymorphicFunctionObject</conceptname> type that invokes the
+ <computeroutput>fusion::at()</computeroutput> accessor function on its arguments.</para>
+ </description>
+ <inherit>
+ <type><classname>proto::callable</classname></type>
+ </inherit>
+ <struct-specialization name="result">
+ <template>
+ <template-type-parameter name="This"/>
+ <template-type-parameter name="Seq"/>
+ <template-type-parameter name="N"/>
+ </template>
+ <specialization>
+ <template-arg>This(Seq, N)</template-arg>
+ </specialization>
+ <inherit>
+ <type>fusion::result_of::at&lt;
+ typename boost::remove_reference&lt;Seq&gt;::type
+ , typename boost::remove_const&lt;typename boost::remove_reference&lt;N&gt;::type&gt;::type
+ &gt;</type>
+ </inherit>
+ </struct-specialization>
+ <method-group name="public member functions">
+ <method name="operator()" cv="const">
+ <type>typename fusion::result_of::at&lt; Seq, N &gt;::type</type>
+ <template>
+ <template-type-parameter name="Seq"/>
+ <template-type-parameter name="N"/>
+ </template>
+ <parameter name="seq">
+ <paramtype>Seq &amp;</paramtype>
+ </parameter>
+ <parameter name="n">
+ <paramtype>N const &amp;</paramtype>
+ </parameter>
+ <returns>
+ <para><computeroutput>fusion::at&lt;N&gt;(seq)</computeroutput></para>
+ </returns>
+ </method>
+ <method name="operator()" cv="const">
+ <type>typename fusion::result_of::at&lt; Seq const, N &gt;::type</type>
+ <template>
+ <template-type-parameter name="Seq"/>
+ <template-type-parameter name="N"/>
+ </template>
+ <parameter name="seq">
+ <paramtype>Seq const &amp;</paramtype>
+ </parameter>
+ <parameter name="n">
+ <paramtype>N const &amp;</paramtype>
+ </parameter>
+ <returns>
+ <para><computeroutput>fusion::at&lt;N&gt;(seq)</computeroutput></para>
+ </returns>
+ </method>
+ </method-group>
+ </struct>
+
+ </namespace>
+ </namespace>
+ </namespace>
+</header>


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