x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
matches.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\xpressive\proto\matches.hpp
旋转
特效
属性
历史版本
#ifndef BOOST_PP_IS_ITERATING /////////////////////////////////////////////////////////////////////////////// /// \file matches.hpp /// Contains definition of matches\<\> metafunction for determining if /// a given expression matches a given pattern. // // 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_MATCHES_HPP_EAN_11_03_2006 #define BOOST_PROTO_MATCHES_HPP_EAN_11_03_2006 #include
// must be first include #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// must be last include // Some compilers (like GCC) need extra help figuring out a template's arity. // I use MPL's BOOST_MPL_AUX_LAMBDA_ARITY_PARAM() macro to disambiguate, which // which is controlled by the BOOST_MPL_LIMIT_METAFUNCTION_ARITY macro. If // You define BOOST_PROTO_MAX_ARITY to be greater than // BOOST_MPL_LIMIT_METAFUNCTION_ARITY on these compilers, things don't work. // You must define BOOST_MPL_LIMIT_METAFUNCTION_ARITY to be greater. #ifdef BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING # if BOOST_PROTO_MAX_ARITY > BOOST_MPL_LIMIT_METAFUNCTION_ARITY # error BOOST_MPL_LIMIT_METAFUNCTION_ARITY must be at least as large as BOOST_PROTO_MAX_ARITY # endif #endif #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma warning(push) # pragma warning(disable:4305) // 'specialization' : truncation from 'const int' to 'bool' #endif namespace boost { namespace proto { namespace detail { struct _; template
struct matches_impl; // and_ and or_ implementation template
struct or1 : mpl::bool_
{ typedef G0 which; }; template
struct and1 : mpl::bool_
{}; template
struct and2; template
struct last; template
::value) > struct lambda_matches : mpl::false_ {}; template
struct lambda_matches
: mpl::true_ {}; template
struct lambda_matches
: mpl::true_ {}; template
class T, typename Expr0, typename Grammar0> struct lambda_matches
, T
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(1) > : lambda_matches
{}; // vararg_matches_impl template
struct vararg_matches_impl; // vararg_matches template
struct vararg_matches : mpl::false_ {}; template
struct vararg_matches
: matches_impl
, expr<_, Args2, Args1::size> > {}; template
struct vararg_matches
: and2< matches_impl
, expr<_, Args2, Args2::size> >::value , vararg_matches_impl
> {}; // How terminal_matches<> handles references and cv-qualifiers. // The cv and ref_ matter *only* if the grammar has a top-level ref_. // // Expr | Grammar | Match // ------------------------------ // T T yes // T & T yes // T const & T yes // T T & no // T & T & yes // T const & T & no // T T const & no // T & T const & no // T const & T const & yes template
struct is_cv_ref_compatible : mpl::true_ {}; template
struct is_cv_ref_compatible
: mpl::false_ {}; template
struct is_cv_ref_compatible
: mpl::bool_
::value == is_const
::value> {}; #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) // MSVC-7.1 has lots of problems with array types that have been // deduced. Partially specializing terminal_matches<> on array types // doesn't seem to work. template< typename T , typename U , bool B = is_array
::type>::value > struct terminal_array_matches : mpl::false_ {}; template
struct terminal_array_matches
: is_convertible
{}; template
struct terminal_array_matches
: is_convertible
{}; template
struct terminal_array_matches
: is_convertible
{}; // terminal_matches template
struct terminal_matches : mpl::or_< mpl::and_< is_cv_ref_compatible
, lambda_matches< typename remove_cv_ref
::type , typename remove_cv_ref
::type > > , terminal_array_matches
> {}; #else // terminal_matches template
struct terminal_matches : mpl::and_< is_cv_ref_compatible
, lambda_matches< typename remove_cv_ref
::type , typename remove_cv_ref
::type > > {}; template
struct terminal_matches
: mpl::true_ {}; template
struct terminal_matches
: mpl::true_ {}; #endif template
struct terminal_matches
: mpl::true_ {}; template
struct terminal_matches
: mpl::true_ {}; template
struct terminal_matches
: mpl::true_ {}; template
struct terminal_matches
: mpl::true_ {}; template
struct terminal_matches
> : mpl::true_ {}; template
struct terminal_matches
> : is_convertible
{}; // matches_impl template
struct matches_impl : mpl::false_ {}; template
struct matches_impl< Expr, proto::_ > : mpl::true_ {}; template
struct matches_impl< expr
, expr
> : vararg_matches< Args1, Args2, typename Args2::back_, (N1+2 > N2), (N2 > N1) > {}; template
struct matches_impl< expr
, expr
> : vararg_matches< Args1, Args2, typename Args2::back_, (N1+2 > N2), (N2 > N1) > {}; template
struct matches_impl< expr
, expr
> : mpl::false_ {}; template
struct matches_impl< expr
, expr
> : matches_impl
{}; template
struct matches_impl< expr
, expr
> : matches_impl
{}; template
struct matches_impl< expr
, expr
> : terminal_matches
{}; #define BOOST_PROTO_MATCHES_N_FUN(z, n, data)\ matches_impl<\ typename Args1::BOOST_PP_CAT(arg, n)::proto_base_expr\ , typename Args2::BOOST_PP_CAT(arg, n)::proto_base_expr\ > #define BOOST_PROTO_DEFINE_MATCHES(z, n, data)\ matches_impl<\ typename Expr::proto_base_expr\ , typename BOOST_PP_CAT(G, n)::proto_base_expr\ > #define BOOST_PROTO_DEFINE_LAMBDA_MATCHES(z, n, data)\ lambda_matches<\ BOOST_PP_CAT(Expr, n)\ , BOOST_PP_CAT(Grammar, n)\ > #if BOOST_PROTO_MAX_LOGICAL_ARITY > BOOST_PROTO_MAX_ARITY #define BOOST_PP_ITERATION_PARAMS_1 (4, (2, BOOST_PROTO_MAX_LOGICAL_ARITY,
, 1)) #else #define BOOST_PP_ITERATION_PARAMS_1 (4, (2, BOOST_PROTO_MAX_ARITY,
, 1)) #endif #include BOOST_PP_ITERATE() #define BOOST_PP_ITERATION_PARAMS_1 (4, (2, BOOST_PROTO_MAX_ARITY,
, 2)) #include BOOST_PP_ITERATE() #undef BOOST_PROTO_MATCHES_N_FUN #undef BOOST_PROTO_DEFINE_MATCHES #undef BOOST_PROTO_DEFINE_LAMBDA_MATCHES // handle proto::if_ template
struct matches_impl
> : mpl::apply1
::type {}; // handle proto::not_ template
struct matches_impl
> : mpl::not_
> {}; // handle proto::switch_ template
struct matches_impl
> : matches_impl< Expr , typename Cases::template case_
::proto_base_expr > {}; } namespace result_of { template
struct matches : detail::matches_impl
{}; } namespace wildcardns_ { struct _ : has_identity_transform { typedef _ proto_base_expr; typedef void proto_is_wildcard_; }; template
transform::detail::yes_type is_wildcard_expression_fun(T const *); } namespace control { // not_ template
struct not_ : has_identity_transform { typedef not_ proto_base_expr; }; // if_ template
struct if_ : or_< and_
, Then> , and_
>, Else> > {}; template
struct if_
: and_
, Then> {}; template
struct if_
: has_identity_transform { typedef if_ proto_base_expr; }; // or_ template
struct or_ { typedef or_ proto_base_expr; template
struct apply { typedef typename detail::matches_impl
::which which; typedef typename which::template apply
::type type; }; template
static typename apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { typedef typename detail::matches_impl
::which which; return which::call(expr, state, visitor); } }; // and_ template
struct and_ { typedef and_ proto_base_expr; template
struct apply { typedef typename detail::last
::type which; typedef typename which::template apply
::type type; }; template
static typename apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { typedef typename detail::last
::type which; return which::call(expr, state, visitor); } }; // switch_ template
struct switch_ { typedef switch_ proto_base_expr; template
struct apply : Cases::template case_
::template apply
{}; template
static typename apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { return Cases::template case_
::call(expr, state, visitor); } }; template
struct exact {}; template
struct convertible_to {}; template
struct vararg : Grammar { typedef void proto_is_vararg_; }; } }} #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma warning(pop) #endif #endif #elif BOOST_PP_ITERATION_FLAGS() == 1 #define N BOOST_PP_ITERATION() template
struct BOOST_PP_CAT(and, N) : BOOST_PP_CAT(and, BOOST_PP_DEC(N))< P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2)) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P) > {}; template
struct BOOST_PP_CAT(and, N)
: mpl::false_ {}; #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY template
struct last
> { typedef BOOST_PP_CAT(G, BOOST_PP_DEC(N)) type; }; template
struct BOOST_PP_CAT(or, N) : BOOST_PP_CAT(or, BOOST_PP_DEC(N))< matches_impl
::value , Expr, BOOST_PP_ENUM_SHIFTED_PARAMS(N, G) > {}; template
struct BOOST_PP_CAT(or, N)
: mpl::true_ { typedef G0 which; }; // handle proto::or_ template
struct matches_impl
> : BOOST_PP_CAT(or, N)< matches_impl
::value, typename Expr::proto_base_expr, BOOST_PP_ENUM_PARAMS(N, G) > {}; // handle proto::and_ template
struct matches_impl
> : detail::BOOST_PP_CAT(and, N)< BOOST_PROTO_DEFINE_MATCHES(~, 0, ~)::value, BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_MATCHES, ~) > {}; #endif #undef N #elif BOOST_PP_ITERATION_FLAGS() == 2 #define N BOOST_PP_ITERATION() template
struct vararg_matches_impl
: and2< matches_impl
::value , vararg_matches_impl
> {}; template
struct vararg_matches_impl
: matches_impl
{}; template< template
class T BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Expr) BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Grammar) > struct lambda_matches
, T
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N) > : BOOST_PP_CAT(and, N)< BOOST_PROTO_DEFINE_LAMBDA_MATCHES(~, 0, ~)::value, BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_LAMBDA_MATCHES, ~) > {}; template
struct matches_impl< expr
, expr
> : BOOST_PP_CAT(and, N)< BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value, BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~) > {}; template
struct matches_impl< expr
, expr
> : BOOST_PP_CAT(and, N)< BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value, BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~) > {}; #undef N #endif
matches.hpp
网页地址
文件地址
上一页
13/21
下一页
下载
( 22 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.