/////////////////////////////////////////////////////////////////////////////// /// \file arg_traits.hpp /// Contains definitions for value_type\<\>, arg_type\<\>, left_type\<\>, /// right_type\<\>, tag_type\<\>, and the helper functions arg(), left(), /// and right(). // // Copyright 2004 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_ARG_TRAITS_HPP_EAN_04_01_2005 #define BOOST_PROTO_ARG_TRAITS_HPP_EAN_04_01_2005 #include #include namespace boost { namespace proto { /////////////////////////////////////////////////////////////////////////////// // value_type // specialize this to control how user-defined types are stored in the parse tree template struct value_type { typedef typename boost::call_traits::value_type type; }; template<> struct value_type { typedef fusion::void_t type; }; /////////////////////////////////////////////////////////////////////////////// // argument type extractors template struct arg_type { typedef typename Op::arg_type type; typedef type const &const_reference; }; template struct arg_type > { typedef typename Op::arg_type type; typedef type const const_reference; }; /////////////////////////////////////////////////////////////////////////////// // argument type extractors template struct left_type { typedef typename Op::left_type type; typedef type const &const_reference; }; template struct left_type > { typedef typename Op::left_type type; typedef type const const_reference; }; /////////////////////////////////////////////////////////////////////////////// // argument type extractors template struct right_type { typedef typename Op::right_type type; typedef type const &const_reference; }; template struct right_type > { typedef typename Op::right_type type; typedef type const const_reference; }; /////////////////////////////////////////////////////////////////////////////// // tag extractor template struct tag_type { typedef typename Op::tag_type type; }; template struct tag_type > { typedef typename Op::tag_type type; }; /////////////////////////////////////////////////////////////////////////////// // arg template inline typename arg_type::const_reference arg(Op const &op) { return op.cast().arg; } /////////////////////////////////////////////////////////////////////////////// // left template inline typename left_type::const_reference left(Op const &op) { return op.cast().left; } /////////////////////////////////////////////////////////////////////////////// // right template inline typename right_type::const_reference right(Op const &op) { return op.cast().right; } }} #endif