Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60404 - in branches/release: . boost boost/algorithm/string boost/archive boost/bimap boost/config boost/detail boost/filesystem boost/functional/hash boost/fusion boost/graph boost/integer boost/interprocess boost/intrusive boost/iostreams boost/math boost/numeric/ublas boost/program_options boost/property_tree boost/proto boost/proto/detail boost/python boost/regex boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/statechart boost/system boost/thread boost/tr1 boost/type_traits boost/unordered boost/uuid boost/variant boost/wave doc libs libs/array/doc libs/bimap libs/config libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/integer libs/interprocess libs/intrusive libs/iostreams libs/math libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/numeric/ublas/doc libs/program_options libs/property_tree libs/proto/doc/reference libs/python libs/regex libs/regex/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/statechart libs/static_assert libs/system libs/thread libs/thread/doc libs/timer libs/tr1 libs/type_traits libs/unordered libs/uuid libs/wave more people status tools tools/bcp tools/build/v2 tools/inspect tools/regression tools/release tools/wave wiki
From: eric_at_[hidden]
Date: 2010-03-09 21:17:47


Author: eric_niebler
Date: 2010-03-09 21:17:46 EST (Tue, 09 Mar 2010)
New Revision: 60404
URL: http://svn.boost.org/trac/boost/changeset/60404

Log:
Merged revisions 60141,60143 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r60141 | eric_niebler | 2010-03-04 11:11:35 +1100 (Thu, 04 Mar 2010) | 1 line
  
  add non-const function call overloads to proto terminals, code reorg
........
  r60143 | eric_niebler | 2010-03-04 13:47:46 +1100 (Thu, 04 Mar 2010) | 1 line
  
  add a default constructor to proto::literal
........

Added:
   branches/release/boost/proto/detail/expr0.hpp
      - copied unchanged from r60143, /trunk/boost/proto/detail/expr0.hpp
   branches/release/boost/proto/detail/expr1.hpp
      - copied unchanged from r60143, /trunk/boost/proto/detail/expr1.hpp
Properties modified:
   branches/release/ (props changed)
   branches/release/CMakeLists.txt (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/array.hpp (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/detail/ (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/iostreams/ (props changed)
   branches/release/boost/math/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/statechart/ (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/unordered/ (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/version.hpp (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/array/doc/array.xml (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/iostreams/ (props changed)
   branches/release/libs/libraries.htm (props changed)
   branches/release/libs/maintainers.txt (props changed)
   branches/release/libs/math/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/statechart/ (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/thread/doc/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/unordered/ (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/people/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/Jamfile.v2 (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
   branches/release/wiki/ (props changed)
Text files modified:
   branches/release/boost/proto/expr.hpp | 636 ++++++++-------------------------------
   branches/release/boost/proto/literal.hpp | 4
   branches/release/libs/proto/doc/reference/literal.xml | 1
   3 files changed, 148 insertions(+), 493 deletions(-)

Modified: branches/release/boost/proto/expr.hpp
==============================================================================
--- branches/release/boost/proto/expr.hpp (original)
+++ branches/release/boost/proto/expr.hpp 2010-03-09 21:17:46 EST (Tue, 09 Mar 2010)
@@ -1,523 +1,173 @@
-#ifndef BOOST_PP_IS_ITERATING
- ///////////////////////////////////////////////////////////////////////////////
- /// \file expr.hpp
- /// Contains definition of expr\<\> class template.
- //
- // Copyright 2008 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_EXPR_HPP_EAN_04_01_2005
- #define BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
-
- #include <boost/preprocessor/cat.hpp>
- #include <boost/preprocessor/arithmetic/dec.hpp>
- #include <boost/preprocessor/selection/max.hpp>
- #include <boost/preprocessor/iteration/iterate.hpp>
- #include <boost/preprocessor/repetition/repeat.hpp>
- #include <boost/preprocessor/repetition/repeat_from_to.hpp>
- #include <boost/preprocessor/repetition/enum_trailing.hpp>
- #include <boost/preprocessor/repetition/enum_params.hpp>
- #include <boost/preprocessor/repetition/enum_binary_params.hpp>
- #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
- #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
- #include <boost/utility/addressof.hpp>
- #include <boost/proto/proto_fwd.hpp>
- #include <boost/proto/args.hpp>
- #include <boost/proto/traits.hpp>
-
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma warning(push)
- # pragma warning(disable : 4510) // default constructor could not be generated
- # pragma warning(disable : 4512) // assignment operator could not be generated
- # pragma warning(disable : 4610) // user defined constructor required
- #endif
-
- namespace boost { namespace proto
- {
-
- namespace detail
- {
- /// INTERNAL ONLY
- ///
- #define BOOST_PROTO_CHILD(Z, N, DATA) \
- typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(proto_child, N); \
- BOOST_PP_CAT(proto_child, N) BOOST_PP_CAT(child, N); \
- /**< INTERNAL ONLY */
-
- /// INTERNAL ONLY
- ///
- #define BOOST_PROTO_VOID(Z, N, DATA) \
- typedef void BOOST_PP_CAT(proto_child, N); \
- /**< INTERNAL ONLY */
-
- struct not_a_valid_type
- {
- private:
- not_a_valid_type()
- {}
- };
-
- template<typename Tag, typename Arg>
- struct address_of_hack
- {
- typedef not_a_valid_type type;
- };
-
- template<typename Expr>
- struct address_of_hack<proto::tag::address_of, Expr &>
- {
- typedef Expr *type;
- };
-
- template<typename T, typename Tag, typename Arg0>
- proto::expr<Tag, proto::term<Arg0>, 0> make_terminal(T &t, proto::expr<Tag, proto::term<Arg0>, 0> *)
- {
- proto::expr<Tag, proto::term<Arg0>, 0> that = {t};
- return that;
- }
-
- template<typename T, typename Tag, typename Arg0, std::size_t N>
- proto::expr<Tag, proto::term<Arg0[N]>, 0> make_terminal(T (&t)[N], proto::expr<Tag, proto::term<Arg0[N]>, 0> *)
- {
- expr<Tag, proto::term<Arg0[N]>, 0> that;
- for(std::size_t i = 0; i < N; ++i)
- {
- that.child0[i] = t[i];
- }
- return that;
- }
-
- template<typename T, typename Tag, typename Arg0, std::size_t N>
- proto::expr<Tag, proto::term<Arg0[N]>, 0> make_terminal(T const(&t)[N], proto::expr<Tag, proto::term<Arg0[N]>, 0> *)
- {
- expr<Tag, proto::term<Arg0[N]>, 0> that;
- for(std::size_t i = 0; i < N; ++i)
- {
- that.child0[i] = t[i];
- }
- return that;
- }
+///////////////////////////////////////////////////////////////////////////////
+/// \file expr.hpp
+/// Contains definition of expr\<\> class template.
+//
+// Copyright 2008 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_EXPR_HPP_EAN_04_01_2005
+#define BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/selection/max.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum_trailing.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+#include <boost/utility/addressof.hpp>
+#include <boost/proto/proto_fwd.hpp>
+#include <boost/proto/args.hpp>
+#include <boost/proto/traits.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(push)
+# pragma warning(disable : 4510) // default constructor could not be generated
+# pragma warning(disable : 4512) // assignment operator could not be generated
+# pragma warning(disable : 4610) // user defined constructor required
+#endif
 
- template<typename T, typename U>
- struct same_cv
- {
- typedef U type;
- };
+namespace boost { namespace proto
+{
 
- template<typename T, typename U>
- struct same_cv<T const, U>
- {
- typedef U const type;
- };
- }
+ namespace detail
+ {
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_CHILD(Z, N, DATA) \
+ typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(proto_child, N); \
+ BOOST_PP_CAT(proto_child, N) BOOST_PP_CAT(child, N); \
+ /**< INTERNAL ONLY */
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VOID(Z, N, DATA) \
+ typedef void BOOST_PP_CAT(proto_child, N); \
+ /**< INTERNAL ONLY */
 
- namespace result_of
+ struct not_a_valid_type
         {
- /// \brief A helper metafunction for computing the
- /// return type of \c proto::expr\<\>::operator().
- template<typename Sig, typename This, typename Domain>
- struct funop;
-
- #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/proto/detail/funop.hpp>))
- #include BOOST_PP_ITERATE()
- }
-
- // TODO consider adding a basic_expr<> that doesn't have operator=,
- // operator[] or operator() for use by BOOST_PROTO_BASIC_EXTENDS().
- // Those member functions are unused in that case, and only slow
- // down instantiations. basic_expr::proto_base_expr can still be
- // expr<> because uses of proto_base_expr in proto::matches<> shouldn't
- // case the expr<> type to be instantiated. (<-- Check that assumtion!)
- // OR, should expr<>::proto_base_expr be a typedef for basic_expr<>?
- // It should, and proto_base() can return *this reinterpret_cast to
- // a basic_expr because they should be layout compatible. Or not, because
- // that would incur an extra template instantiation. :-(
-
- namespace exprns_
+ private:
+ not_a_valid_type()
+ {}
+ };
+
+ template<typename Tag, typename Arg>
+ struct address_of_hack
         {
- #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/expr.hpp>))
- #include BOOST_PP_ITERATE()
- }
-
- #undef BOOST_PROTO_CHILD
- #undef BOOST_PROTO_VOID
+ typedef not_a_valid_type type;
+ };
 
- /// \brief Lets you inherit the interface of an expression
- /// while hiding from Proto the fact that the type is a Proto
- /// expression.
         template<typename Expr>
- struct unexpr
- : Expr
+ struct address_of_hack<proto::tag::address_of, Expr &>
         {
- BOOST_PROTO_UNEXPR()
-
- explicit unexpr(Expr const &e)
- : Expr(e)
- {}
-
- using Expr::operator =;
+ typedef Expr *type;
         };
 
- }}
-
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma warning(pop)
- #endif
-
- #endif // BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
-
-// For gcc 4.4 compatability, we must include the
-// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
-#else // BOOST_PP_IS_ITERATING
-#if BOOST_PP_ITERATION_DEPTH() == 1
-
- #define ARG_COUNT BOOST_PP_MAX(1, BOOST_PP_ITERATION())
- #define IS_TERMINAL 0 == BOOST_PP_ITERATION()
-
- /// \brief Representation of a node in an expression tree.
- ///
- /// \c proto::expr\<\> is a node in an expression template tree. It
- /// is a container for its child sub-trees. It also serves as
- /// the terminal nodes of the tree.
- ///
- /// \c Tag is type that represents the operation encoded by
- /// this expression. It is typically one of the structs
- /// in the \c boost::proto::tag namespace, but it doesn't
- /// have to be.
- ///
- /// \c Args is a type list representing the type of the children
- /// of this expression. It is an instantiation of one
- /// of \c proto::list1\<\>, \c proto::list2\<\>, etc. The
- /// child types must all themselves be either \c expr\<\>
- /// or <tt>proto::expr\<\>&</tt>. If \c Args is an
- /// instantiation of \c proto::term\<\> then this
- /// \c expr\<\> type represents a terminal expression;
- /// the parameter to the \c proto::term\<\> template
- /// represents the terminal's value type.
- ///
- /// \c Arity is an integral constant representing the number of child
- /// nodes this node contains. If \c Arity is 0, then this
- /// node is a terminal.
- ///
- /// \c proto::expr\<\> is a valid Fusion random-access sequence, where
- /// the elements of the sequence are the child expressions.
- #if IS_TERMINAL
- template<typename Tag, typename Arg0>
- struct expr<Tag, term<Arg0>, 0>
- #else
- template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(ARG_COUNT, typename Arg)>
- struct expr<Tag, BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)>, BOOST_PP_ITERATION() >
- #endif
+ template<typename T, typename Tag, typename Arg0>
+ proto::expr<Tag, proto::term<Arg0>, 0> make_terminal(T &t, proto::expr<Tag, proto::term<Arg0>, 0> *)
         {
- typedef Tag proto_tag;
- BOOST_STATIC_CONSTANT(long, proto_arity_c = BOOST_PP_ITERATION());
- typedef mpl::long_<BOOST_PP_ITERATION() > proto_arity;
- typedef expr proto_base_expr;
- #if IS_TERMINAL
- typedef term<Arg0> proto_args;
- #else
- typedef BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)> proto_args;
- #endif
- typedef default_domain proto_domain;
- typedef proto::tag::proto_expr fusion_tag;
- typedef expr proto_derived_expr;
- typedef void proto_is_expr_; /**< INTERNAL ONLY */
-
- BOOST_PP_REPEAT(ARG_COUNT, BOOST_PROTO_CHILD, ~)
- BOOST_PP_REPEAT_FROM_TO(ARG_COUNT, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_VOID, ~)
-
- /// \return *this
- ///
- expr const &proto_base() const
- {
- return *this;
- }
-
- /// \overload
- ///
- expr &proto_base()
- {
- return *this;
- }
-
- #if IS_TERMINAL
- /// \return A new \c expr\<\> object initialized with the specified
- /// arguments.
- ///
- template<typename A0>
- static expr const make(A0 &a0)
- {
- return detail::make_terminal(a0, static_cast<expr *>(0));
- }
-
- /// \overload
- ///
- template<typename A0>
- static expr const make(A0 const &a0)
- {
- return detail::make_terminal(a0, static_cast<expr *>(0));
- }
- #else
- /// \return A new \c expr\<\> object initialized with the specified
- /// arguments.
- ///
- template<BOOST_PP_ENUM_PARAMS(ARG_COUNT, typename A)>
- static expr const make(BOOST_PP_ENUM_BINARY_PARAMS(ARG_COUNT, A, const &a))
- {
- expr that = {BOOST_PP_ENUM_PARAMS(ARG_COUNT, a)};
- return that;
- }
- #endif
-
- #if 1 == BOOST_PP_ITERATION()
- /// If \c Tag is \c boost::proto::tag::address_of and \c proto_child0 is
- /// <tt>T&</tt>, then \c address_of_hack_type_ is <tt>T*</tt>.
- /// Otherwise, it is some undefined type.
- typedef typename detail::address_of_hack<Tag, proto_child0>::type address_of_hack_type_;
-
- /// \return The address of <tt>this->child0</tt> if \c Tag is
- /// \c boost::proto::tag::address_of. Otherwise, this function will
- /// fail to compile.
- ///
- /// \attention Proto overloads <tt>operator&</tt>, which means that
- /// proto-ified objects cannot have their addresses taken, unless we use
- /// the following hack to make \c &x implicitly convertible to \c X*.
- operator address_of_hack_type_() const
- {
- return boost::addressof(this->child0);
- }
- #else
- /// INTERNAL ONLY
- ///
- typedef detail::not_a_valid_type address_of_hack_type_;
- #endif
-
- /// Assignment
- ///
- /// \param a The rhs.
- /// \return A new \c expr\<\> node representing an assignment of \c a to \c *this.
- template<typename A>
- proto::expr<
- proto::tag::assign
- , list2<expr const &, typename result_of::as_child<A>::type>
- , 2
- > const
- operator =(A &a) const
- {
- proto::expr<
- proto::tag::assign
- , list2<expr const &, typename result_of::as_child<A>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
- }
-
- /// \overload
- ///
- template<typename A>
- proto::expr<
- proto::tag::assign
- , list2<expr const &, typename result_of::as_child<A const>::type>
- , 2
- > const
- operator =(A const &a) const
- {
- proto::expr<
- proto::tag::assign
- , list2<expr const &, typename result_of::as_child<A const>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
- }
-
- #if IS_TERMINAL
- /// \overload
- ///
- template<typename A>
- proto::expr<
- proto::tag::assign
- , list2<expr &, typename result_of::as_child<A>::type>
- , 2
- > const
- operator =(A &a)
- {
- proto::expr<
- proto::tag::assign
- , list2<expr &, typename result_of::as_child<A>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
- }
-
- /// \overload
- ///
- template<typename A>
- proto::expr<
- proto::tag::assign
- , list2<expr &, typename result_of::as_child<A const>::type>
- , 2
- > const
- operator =(A const &a)
- {
- proto::expr<
- proto::tag::assign
- , list2<expr &, typename result_of::as_child<A const>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
- }
- #endif
-
- /// Subscript
- ///
- /// \param a The rhs.
- /// \return A new \c expr\<\> node representing \c *this subscripted with \c a.
- template<typename A>
- proto::expr<
- proto::tag::subscript
- , list2<expr const &, typename result_of::as_child<A>::type>
- , 2
- > const
- operator [](A &a) const
- {
- proto::expr<
- proto::tag::subscript
- , list2<expr const &, typename result_of::as_child<A>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
- }
+ proto::expr<Tag, proto::term<Arg0>, 0> that = {t};
+ return that;
+ }
 
- /// \overload
- ///
- template<typename A>
- proto::expr<
- proto::tag::subscript
- , list2<expr const &, typename result_of::as_child<A const>::type>
- , 2
- > const
- operator [](A const &a) const
+ template<typename T, typename Tag, typename Arg0, std::size_t N>
+ proto::expr<Tag, proto::term<Arg0[N]>, 0> make_terminal(T (&t)[N], proto::expr<Tag, proto::term<Arg0[N]>, 0> *)
+ {
+ expr<Tag, proto::term<Arg0[N]>, 0> that;
+ for(std::size_t i = 0; i < N; ++i)
             {
- proto::expr<
- proto::tag::subscript
- , list2<expr const &, typename result_of::as_child<A const>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
+ that.child0[i] = t[i];
             }
+ return that;
+ }
 
- #if IS_TERMINAL
- /// \overload
- ///
- template<typename A>
- proto::expr<
- proto::tag::subscript
- , list2<expr &, typename result_of::as_child<A>::type>
- , 2
- > const
- operator [](A &a)
+ template<typename T, typename Tag, typename Arg0, std::size_t N>
+ proto::expr<Tag, proto::term<Arg0[N]>, 0> make_terminal(T const(&t)[N], proto::expr<Tag, proto::term<Arg0[N]>, 0> *)
+ {
+ expr<Tag, proto::term<Arg0[N]>, 0> that;
+ for(std::size_t i = 0; i < N; ++i)
             {
- proto::expr<
- proto::tag::subscript
- , list2<expr &, typename result_of::as_child<A>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
+ that.child0[i] = t[i];
             }
+ return that;
+ }
 
- /// \overload
- ///
- template<typename A>
- proto::expr<
- proto::tag::subscript
- , list2<expr &, typename result_of::as_child<A const>::type>
- , 2
- > const
- operator [](A const &a)
- {
- proto::expr<
- proto::tag::subscript
- , list2<expr &, typename result_of::as_child<A const>::type>
- , 2
- > that = {*this, proto::as_child(a)};
- return that;
- }
- #endif
+ template<typename T, typename U>
+ struct same_cv
+ {
+ typedef U type;
+ };
 
- /// Encodes the return type of \c expr\<\>::operator(), for use with \c boost::result_of\<\>
- ///
- template<typename Sig>
- struct result
- {
- typedef typename result_of::funop<Sig, expr, default_domain>::type const type;
- };
+ template<typename T, typename U>
+ struct same_cv<T const, U>
+ {
+ typedef U const type;
+ };
+ }
 
- /// Function call
- ///
- /// \return A new \c expr\<\> node representing the function invocation of \c (*this)().
- proto::expr<proto::tag::function, list1<expr const &>, 1> const
- operator ()() const
- {
- proto::expr<proto::tag::function, list1<expr const &>, 1> that = {*this};
- return that;
- }
+ namespace result_of
+ {
+ /// \brief A helper metafunction for computing the
+ /// return type of \c proto::expr\<\>::operator().
+ template<typename Sig, typename This, typename Domain>
+ struct funop;
 
- #if IS_TERMINAL
- /// \overload
- ///
- proto::expr<proto::tag::function, list1<expr &>, 1> const
- operator ()()
- {
- proto::expr<proto::tag::function, list1<expr &>, 1> that = {*this};
- return that;
- }
- #endif
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/proto/detail/funop.hpp>))
+ #include BOOST_PP_ITERATE()
+ }
 
- #define BOOST_PP_ITERATION_PARAMS_2 (3, (1, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/proto/expr.hpp>))
- #include BOOST_PP_ITERATE()
- };
+ // TODO consider adding a basic_expr<> that doesn't have operator=,
+ // operator[] or operator() for use by BOOST_PROTO_BASIC_EXTENDS().
+ // Those member functions are unused in that case, and only slow
+ // down instantiations. basic_expr::proto_base_expr can still be
+ // expr<> because uses of proto_base_expr in proto::matches<> shouldn't
+ // cause the expr<> type to be instantiated. (<-- Check that assumtion!)
+ // OR, should expr<>::proto_base_expr be a typedef for basic_expr<>?
+ // It should, and proto_base() can return *this reinterpret_cast to
+ // a basic_expr because they should be layout compatible. Or not, because
+ // that would incur an extra template instantiation. :-(
 
- #undef ARG_COUNT
- #undef IS_TERMINAL
+ namespace exprns_
+ {
+ // The expr<> specializations are actually defined here.
+ #define BOOST_PROTO_DEFINE_TERMINAL
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/proto/detail/expr0.hpp>))
+ #include BOOST_PP_ITERATE()
 
-#elif BOOST_PP_ITERATION_DEPTH() == 2
+ #undef BOOST_PROTO_DEFINE_TERMINAL
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/expr0.hpp>))
+ #include BOOST_PP_ITERATE()
+ }
 
- #define N BOOST_PP_ITERATION()
+ #undef BOOST_PROTO_CHILD
+ #undef BOOST_PROTO_VOID
 
- /// \overload
- ///
- template<BOOST_PP_ENUM_PARAMS(N, typename A)>
- typename result_of::BOOST_PP_CAT(funop, N)<
- expr const
- , default_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::type const
- operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a)) const
- {
- return result_of::BOOST_PP_CAT(funop, N)<
- expr const
- , default_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));
- }
+ /// \brief Lets you inherit the interface of an expression
+ /// while hiding from Proto the fact that the type is a Proto
+ /// expression.
+ template<typename Expr>
+ struct unexpr
+ : Expr
+ {
+ BOOST_PROTO_UNEXPR()
 
- #if IS_TERMINAL
- /// \overload
- ///
- template<BOOST_PP_ENUM_PARAMS(N, typename A)>
- typename result_of::BOOST_PP_CAT(funop, N)<
- expr
- , default_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::type const
- operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a))
- {
- return result_of::BOOST_PP_CAT(funop, N)<
- expr
- , default_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
- >::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));
- }
- #endif
+ explicit unexpr(Expr const &e)
+ : Expr(e)
+ {}
+
+ using Expr::operator =;
+ };
 
- #undef N
+}}
 
-#endif // BOOST_PP_ITERATION_DEPTH()
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
 #endif
+
+#endif // BOOST_PROTO_EXPR_HPP_EAN_04_01_2005

Modified: branches/release/boost/proto/literal.hpp
==============================================================================
--- branches/release/boost/proto/literal.hpp (original)
+++ branches/release/boost/proto/literal.hpp 2010-03-09 21:17:46 EST (Tue, 09 Mar 2010)
@@ -45,6 +45,10 @@
             typedef typename detail::term_traits<T>::reference reference;
             typedef typename detail::term_traits<T>::const_reference const_reference;
 
+ literal()
+ : base_type(terminal_type::make(T()))
+ {}
+
             template<typename U>
             literal(U &u)
               : base_type(terminal_type::make(u))

Modified: branches/release/libs/proto/doc/reference/literal.xml
==============================================================================
--- branches/release/libs/proto/doc/reference/literal.xml (original)
+++ branches/release/libs/proto/doc/reference/literal.xml 2010-03-09 21:17:46 EST (Tue, 09 Mar 2010)
@@ -61,6 +61,7 @@
             </returns>
           </method>
         </method-group>
+ <constructor/>
         <constructor>
           <template>
             <template-type-parameter name="U"/>


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