x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
operators.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\xpressive\proto\operators.hpp
Girar
Efecto
Propiedad
Historial
/////////////////////////////////////////////////////////////////////////////// /// \file operators.hpp /// Contains all the overloaded operators that make it possible to build /// expression templates using proto components // // Copyright 2007 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_OPERATORS_HPP_EAN_04_01_2005 #define BOOST_PROTO_OPERATORS_HPP_EAN_04_01_2005 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace proto { namespace detail { template
struct as_expr_if2 {}; template
struct as_expr_if2
: generate_if< typename Left::proto_domain , expr< Tag , args2< ref_
, typename Left::proto_domain::template apply
> >::type > > > { typedef expr
> term_type; typedef expr
, typename Left::proto_domain::template apply
::type> > expr_type; static typename Left::proto_domain::template apply
::type make(Left &left, Right &right) { term_type term = {right}; expr_type that = {{left}, Left::proto_domain::make(term)}; return Left::proto_domain::make(that); } }; template
struct as_expr_if2
: generate_if< typename Right::proto_domain , expr< Tag , args2< typename Right::proto_domain::template apply
> >::type , ref_
> > > { typedef expr
> term_type; typedef expr
::type, ref_
> > expr_type; static typename Right::proto_domain::template apply
::type make(Left &left, Right &right) { term_type term = {left}; expr_type that = {Right::proto_domain::make(term), {right}}; return Right::proto_domain::make(that); } }; template
struct as_expr_if : as_expr_if2
{}; template
struct as_expr_if
: generate_if< typename Left::proto_domain , expr
, ref_
> > > { typedef expr
, ref_
> > expr_type; BOOST_MPL_ASSERT((is_same
)); static typename Left::proto_domain::template apply
::type make(Left &left, Right &right) { expr_type that = {{left}, {right}}; return Left::proto_domain::make(that); } }; template
struct arg_weight { BOOST_STATIC_CONSTANT(int, value = 1 + Trait::value); }; template
struct arg_weight
{ BOOST_STATIC_CONSTANT(int, value = 0); }; template
struct enable_unary : boost::enable_if< boost::mpl::and_
> , Expr > {}; template
struct enable_unary
: boost::enable_if< boost::mpl::and_< Trait , boost::proto::matches
::type::grammar> > , Expr > {}; template
struct enable_unary
: boost::enable_if
{}; template
struct enable_binary : boost::enable_if< boost::mpl::and_< mpl::bool_<(3 <= (arg_weight
::value + arg_weight
::value))> , boost::proto::matches
> , Expr > {}; template
struct enable_binary
: boost::enable_if< boost::mpl::and_< mpl::bool_<(3 <= (arg_weight
::value + arg_weight
::value))> , boost::proto::matches
::type, Arg2>::type::grammar> > , Expr > {}; template
struct enable_binary
: boost::enable_if_c< (3 <= (arg_weight
::value + arg_weight
::value)) , Expr > {}; } // detail #define BOOST_PROTO_UNARY_OP_IS_POSTFIX_0 #define BOOST_PROTO_UNARY_OP_IS_POSTFIX_1 , int #define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, POST) \ template
\ typename detail::generate_if< \ typename Arg::proto_domain \ , expr
> > \ >::type const \ operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \ { \ typedef expr
> > that_type; \ that_type that = {{arg}}; \ return Arg::proto_domain::make(that); \ } \ template
\ typename detail::generate_if< \ typename Arg::proto_domain \ , expr
> > \ >::type const \ operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \ { \ typedef expr
> > that_type; \ that_type that = {{arg}}; \ return Arg::proto_domain::make(that); \ } \ /**/ #define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG) \ template
\ inline typename detail::as_expr_if
::type const \ operator OP(Left &left, Right &right) \ { \ return detail::as_expr_if
::make(left, right); \ } \ template
\ inline typename detail::as_expr_if
::type const \ operator OP(Left &left, Right const &right) \ { \ return detail::as_expr_if
::make(left, right); \ } \ template
\ inline typename detail::as_expr_if
::type const \ operator OP(Left const &left, Right &right) \ { \ return detail::as_expr_if
::make(left, right); \ } \ template
\ inline typename detail::as_expr_if
::type const \ operator OP(Left const &left, Right const &right) \ { \ return detail::as_expr_if
::make(left, right); \ } \ /**/ namespace exprns_ { BOOST_PROTO_DEFINE_UNARY_OPERATOR(+, tag::posit, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(-, tag::negate, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(*, tag::dereference, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(~, tag::complement, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(&, tag::address_of, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(!, tag::logical_not, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, tag::pre_inc, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, tag::pre_dec, 0) BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, tag::post_inc, 1) BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, tag::post_dec, 1) BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<, tag::shift_left) BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>, tag::shift_right) BOOST_PROTO_DEFINE_BINARY_OPERATOR(*, tag::multiplies) BOOST_PROTO_DEFINE_BINARY_OPERATOR(/, tag::divides) BOOST_PROTO_DEFINE_BINARY_OPERATOR(%, tag::modulus) BOOST_PROTO_DEFINE_BINARY_OPERATOR(+, tag::plus) BOOST_PROTO_DEFINE_BINARY_OPERATOR(-, tag::minus) BOOST_PROTO_DEFINE_BINARY_OPERATOR(<, tag::less) BOOST_PROTO_DEFINE_BINARY_OPERATOR(>, tag::greater) BOOST_PROTO_DEFINE_BINARY_OPERATOR(<=, tag::less_equal) BOOST_PROTO_DEFINE_BINARY_OPERATOR(>=, tag::greater_equal) BOOST_PROTO_DEFINE_BINARY_OPERATOR(==, tag::equal_to) BOOST_PROTO_DEFINE_BINARY_OPERATOR(!=, tag::not_equal_to) BOOST_PROTO_DEFINE_BINARY_OPERATOR(||, tag::logical_or) BOOST_PROTO_DEFINE_BINARY_OPERATOR(&&, tag::logical_and) BOOST_PROTO_DEFINE_BINARY_OPERATOR(&, tag::bitwise_and) BOOST_PROTO_DEFINE_BINARY_OPERATOR(|, tag::bitwise_or) BOOST_PROTO_DEFINE_BINARY_OPERATOR(^, tag::bitwise_xor) BOOST_PROTO_DEFINE_BINARY_OPERATOR(BOOST_PP_COMMA(), tag::comma) BOOST_PROTO_DEFINE_BINARY_OPERATOR(->*, tag::mem_ptr) BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<=, tag::shift_left_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>=, tag::shift_right_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(*=, tag::multiplies_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(/=, tag::divides_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(%=, tag::modulus_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(+=, tag::plus_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(-=, tag::minus_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(&=, tag::bitwise_and_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(|=, tag::bitwise_or_assign) BOOST_PROTO_DEFINE_BINARY_OPERATOR(^=, tag::bitwise_xor_assign) /// if_else /// BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE( 3 , if_else , deduce_domain , (tag::if_else_) , BOOST_PP_SEQ_NIL ) } // exprns_ using exprns_::if_else; #undef BOOST_PROTO_DEFINE_UNARY_OPERATOR #undef BOOST_PROTO_DEFINE_BINARY_OPERATOR #define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, TRAIT, DOMAIN, POST) \ template
\ typename boost::proto::detail::enable_unary
, Arg \ , typename boost::proto::result_of::make_expr
::type \ >::type const \ operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \ { \ return boost::proto::result_of::make_expr
::call(arg); \ } \ template
\ typename boost::proto::detail::enable_unary
, Arg \ , typename boost::proto::result_of::make_expr
::type \ >::type const \ operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \ { \ return boost::proto::result_of::make_expr
::call(arg); \ } \ /**/ #define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG, TRAIT, DOMAIN) \ template
\ typename boost::proto::detail::enable_binary
, Left, TRAIT
, Right \ , typename boost::proto::result_of::make_expr
::type \ >::type const \ operator OP(Left &left, Right &right) \ { \ return boost::proto::result_of::make_expr
\ ::call(left, right); \ } \ template
\ typename boost::proto::detail::enable_binary
, Left, TRAIT
, Right \ , typename boost::proto::result_of::make_expr
::type \ >::type const \ operator OP(Left &left, Right const &right) \ { \ return boost::proto::result_of::make_expr
\ ::call(left, right); \ } \ template
\ typename boost::proto::detail::enable_binary
, Left, TRAIT
, Right \ , typename boost::proto::result_of::make_expr
::type \ >::type const \ operator OP(Left const &left, Right &right) \ { \ return boost::proto::result_of::make_expr
\ ::call(left, right); \ } \ template
\ typename boost::proto::detail::enable_binary
, Left, TRAIT
, Right \ , typename boost::proto::result_of::make_expr
::type \ >::type const \ operator OP(Left const &left, Right const &right) \ { \ return boost::proto::result_of::make_expr
\ ::call(left, right); \ } \ /**/ #define BOOST_PROTO_DEFINE_OPERATORS(TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(+, boost::proto::tag::posit, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(-, boost::proto::tag::negate, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(*, boost::proto::tag::dereference, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(~, boost::proto::tag::complement, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(&, boost::proto::tag::address_of, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(!, boost::proto::tag::logical_not, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, boost::proto::tag::pre_inc, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, boost::proto::tag::pre_dec, TRAIT, DOMAIN, 0) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, boost::proto::tag::post_inc, TRAIT, DOMAIN, 1) \ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, boost::proto::tag::post_dec, TRAIT, DOMAIN, 1) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<, boost::proto::tag::shift_left, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>, boost::proto::tag::shift_right, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*, boost::proto::tag::multiplies, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/, boost::proto::tag::divides, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%, boost::proto::tag::modulus, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+, boost::proto::tag::plus, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-, boost::proto::tag::minus, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<, boost::proto::tag::less, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>, boost::proto::tag::greater, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<=, boost::proto::tag::less_equal, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>=, boost::proto::tag::greater_equal, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(==, boost::proto::tag::equal_to, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(!=, boost::proto::tag::not_equal_to, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(||, boost::proto::tag::logical_or, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&&, boost::proto::tag::logical_and, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&, boost::proto::tag::bitwise_and, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|, boost::proto::tag::bitwise_or, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^, boost::proto::tag::bitwise_xor, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(BOOST_PP_COMMA(), boost::proto::tag::comma, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(->*, boost::proto::tag::mem_ptr, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<=, boost::proto::tag::shift_left_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>=, boost::proto::tag::shift_right_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*=, boost::proto::tag::multiplies_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/=, boost::proto::tag::divides_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%=, boost::proto::tag::modulus_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+=, boost::proto::tag::plus_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-=, boost::proto::tag::minus_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&=, boost::proto::tag::bitwise_and_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|=, boost::proto::tag::bitwise_or_assign, TRAIT, DOMAIN) \ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^=, boost::proto::tag::bitwise_xor_assign, TRAIT, DOMAIN) \ /**/ template
struct is_extension : mpl::false_ {}; #ifndef BOOST_PROTO_DOXYGEN_INVOKED namespace exops { BOOST_PROTO_DEFINE_OPERATORS(is_extension, default_domain) using proto::if_else; } #endif }} #endif
operators.hpp
Dirección de la página
Dirección del archivo
Anterior
14/21
Siguiente
Descargar
( 24 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.