Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/phoenix/function/lazy_signature.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 ////////////////////////////////////////////////////////////////////////////
0002 // lazy_signature.hpp
0003 //
0004 // Build signature structs for Phoenix equivalents for FC++
0005 // which are located in lazy_prelude.hpp
0006 //
0007 // These are not direct equivalents of the Boost FC++ structs.
0008 // This file has to be included after lazy_list.hpp
0009 //
0010 // Implemented so far:
0011 //
0012 //   RTEFH    == ReturnTypeEnumFromHelper    (used in enum_from, enum_from_to)
0013 //   RTFD     == ReturnTypeFunctionDelay     (used in repeat)
0014 //   RTFFX    == ReturnTypeFunctoidFwithX     (used in thunk1)
0015 //   RTFFXY   == ReturnTypeFunctoidFwithXandY (used in thunk2)
0016 //   RTFFXYZ  == ReturnTypeFunctoidFwithXandYandZ (used in thunk3)
0017 //   RTF      == ReturnTypeF                  (used in ptr_to_fun0)
0018 //   RTFX     == ReturnTypeFwithX          (used in ptr_to_fun, ptr_to_mem_fun)
0019 //   RTFXY    == ReturnTypeFwithXandY      (used in ptr_to_fun, ptr_to_mem_fun)
0020 //   RTFXYZ   == ReturnTypeFwithXandYandZ  (used in ptr_to_fun, ptr_to_mem_fun)
0021 //   RTFWXYZ  == ReturnTypeFwithWandXandYandZ (used in ptr_to_fun)
0022 //   RTFGHX   == ReturnTypeFandGandHwithX    (used in compose)
0023 //   RTFGHXY  == ReturnTypeFandGandHwithXY   (used in compose)
0024 //   RTFGHXYZ == ReturnTypeFandGandHwithXYZ  (used in compose)
0025 //   RTFGX    == ReturnTypeFandGwithX        (used in compose)
0026 //   RTFGXY   == ReturnTypeFandGwithXY       (used in compose)
0027 //   RTFGXYZ  == ReturnTypeFandGwithXYZ      (used in compose)
0028 //   RTFL     == ReturnTypeFunctionList      (used in map)
0029 //   RTAB     == ReturnTypeListAListB        (used in zip)
0030 //   RTZAB    == ReturnTypeZipListAListB     (used in zip_with)
0031 //
0032 ////////////////////////////////////////////////////////////////////////////
0033 /*=============================================================================
0034     Copyright (c) 2000-2003 Brian McNamara and Yannis Smaragdakis
0035     Copyright (c) 2001-2007 Joel de Guzman
0036     Copyright (c) 2015 John Fletcher
0037 
0038     Distributed under the Boost Software License, Version 1.0. (See accompanying
0039     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0040 ==============================================================================*/
0041 
0042 #ifndef BOOST_PHOENIX_FUNCTION_LAZY_SIGNATURE
0043 #define BOOST_PHOENIX_FUNCTION_LAZY_SIGNATURE
0044 
0045 namespace boost {
0046 
0047   namespace phoenix {
0048 
0049     namespace impl {
0050 
0051       //template <class T> struct remove_RC; in lazy_operator.hpp
0052 
0053       // RTEFH == ReturnTypeEnumFromHelper
0054       template <class T>
0055       struct RTEFH
0056       {
0057           typedef typename UseList::template List<T>::type LType;
0058           typedef typename result_of::ListType<LType>::
0059                            delay_result_type type;
0060       };
0061 
0062       // RTFD == ReturnTypeFunctionDelay (used in repeat)
0063       template <class T>
0064       struct RTFD {
0065           typedef typename remove_RC<T>::type TTT;
0066           typedef typename UseList::template List<TTT>::type LType;
0067           typedef typename result_of::ListType<LType>::
0068                            delay_result_type type;
0069       };
0070 
0071 
0072       //   RTFFX   == ReturnTypeFunctoidFwithX   (used in thunk1)
0073       template <class F,class X>
0074       struct RTFFX {
0075           typedef typename remove_RC<F>::type FType;
0076           typedef typename remove_RC<X>::type XType;
0077           typedef typename boost::result_of<FType(XType)>::type FR;
0078           typedef typename boost::result_of<FR()>::type RR;
0079           typedef typename remove_RC<RR>::type RType;
0080           typedef RType type;
0081       };
0082 
0083       //   RTFFXY   == ReturnTypeFunctoidFwithXandY   (used in thunk2)
0084       template <class F,class X,class Y>
0085       struct RTFFXY {
0086           typedef typename remove_RC<F>::type FType;
0087           typedef typename remove_RC<X>::type XType;
0088           typedef typename remove_RC<Y>::type YType;
0089           typedef typename boost::result_of<FType(XType,YType)>::type FR;
0090           typedef typename boost::result_of<FR()>::type RR;
0091           typedef typename remove_RC<RR>::type RType;
0092           typedef RType type;
0093       };
0094 
0095       //   RTFFXYZ  == ReturnTypeFunctoidFwithXandYandZ  (used in thunk3)
0096       template <class F,class X,class Y,class Z>
0097       struct RTFFXYZ {
0098           typedef typename remove_RC<F>::type FType;
0099           typedef typename remove_RC<X>::type XType;
0100           typedef typename remove_RC<Y>::type YType;
0101           typedef typename remove_RC<Z>::type ZType;
0102           typedef typename boost::result_of<FType(XType,YType,ZType)>::type FR;
0103           typedef typename boost::result_of<FR()>::type RR;
0104           typedef typename remove_RC<RR>::type RType;
0105           typedef RType type;
0106       };
0107 
0108       //   RTF   == ReturnTypeF     (used in ptr_to_fun0)
0109       template <class F>
0110       struct RTF {
0111           typedef typename remove_RC<F>::type FType;
0112           typedef typename boost::result_of<FType()>::type FR;
0113           typedef typename remove_RC<FR>::type RType;
0114           typedef RType type;
0115       };
0116 
0117       //   RTFX   == ReturnTypeFwithX     (used in ptr_to_fun)
0118       template <class F,class X>
0119       struct RTFX {
0120           typedef typename remove_RC<F>::type FType;
0121           typedef typename remove_RC<X>::type XType;
0122           typedef typename boost::result_of<FType(XType)>::type FR;
0123           typedef typename remove_RC<FR>::type RType;
0124           typedef RType type;
0125       };
0126 
0127       //   RTFXY  == ReturnTypeFwithXandY     (used in ptr_to_fun)
0128       template <class F,class X,class Y>
0129       struct RTFXY {
0130           typedef typename remove_RC<F>::type FType;
0131           typedef typename remove_RC<X>::type XType;
0132           typedef typename remove_RC<Y>::type YType;
0133           typedef typename boost::result_of<FType(XType,YType)>::type FR;
0134           typedef typename remove_RC<FR>::type RType;
0135           typedef RType type;
0136       };
0137 
0138       //   RTFXYZ  == ReturnTypeFwithXandYandZ  (used in ptr_to_fun)
0139       template <class F,class X,class Y,class Z>
0140       struct RTFXYZ {
0141           typedef typename remove_RC<F>::type FType;
0142           typedef typename remove_RC<X>::type XType;
0143           typedef typename remove_RC<Y>::type YType;
0144           typedef typename remove_RC<Z>::type ZType;
0145           typedef typename boost::result_of<FType(XType,YType,ZType)>::type FR;
0146           typedef typename remove_RC<FR>::type RType;
0147           typedef RType type;
0148       };
0149 
0150       //   RTFWXYZ  == ReturnTypeFwithWandXandYandZ  (used in ptr_to_fun)
0151       template <class F,class W,class X,class Y,class Z>
0152       struct RTFWXYZ {
0153           typedef typename remove_RC<F>::type FType;
0154           typedef typename remove_RC<W>::type WType;
0155           typedef typename remove_RC<X>::type XType;
0156           typedef typename remove_RC<Y>::type YType;
0157           typedef typename remove_RC<Z>::type ZType;
0158           typedef typename boost::result_of<FType(WType,XType,YType,ZType)>::
0159                   type FR;
0160           typedef typename remove_RC<FR>::type RType;
0161           typedef RType type;
0162       };
0163 
0164       //   RTFGHX  == ReturnTypeFandGandHwithX (used in compose)
0165       template <class F,class G,class H,class X>
0166       struct RTFGHX {
0167           typedef typename remove_RC<F>::type FType;
0168           typedef typename remove_RC<G>::type GType;
0169           typedef typename remove_RC<H>::type HType;
0170           typedef typename remove_RC<X>::type XType;
0171           typedef typename boost::result_of<GType(XType)>::type GR;
0172           typedef typename boost::result_of<GR()>::type GRR;
0173           typedef typename remove_RC<GRR>::type GRType;
0174           typedef typename boost::result_of<HType(XType)>::type HR;
0175           typedef typename boost::result_of<HR()>::type HRR;
0176           typedef typename remove_RC<HRR>::type HRType;
0177           typedef typename boost::result_of<FType(GRType,HRType)>::type FR;
0178           typedef typename boost::result_of<FR()>::type RR;
0179           typedef typename remove_RC<RR>::type RType;
0180           typedef RType type;
0181       };
0182 
0183       //   RTFGHXY == ReturnTypeFandGandHwithXY (used in compose)
0184       template <class F,class G,class H,class X,class Y>
0185       struct RTFGHXY {
0186           typedef typename remove_RC<F>::type FType;
0187           typedef typename remove_RC<G>::type GType;
0188           typedef typename remove_RC<H>::type HType;
0189           typedef typename remove_RC<X>::type XType;
0190           typedef typename remove_RC<Y>::type YType;
0191           typedef typename boost::result_of<GType(XType,YType)>::type GR;
0192           typedef typename boost::result_of<GR()>::type GRR;
0193           typedef typename remove_RC<GRR>::type GRType;
0194           typedef typename boost::result_of<HType(XType,YType)>::type HR;
0195           typedef typename boost::result_of<HR()>::type HRR;
0196           typedef typename remove_RC<HRR>::type HRType;
0197           typedef typename boost::result_of<FType(GRType,HRType)>::type FR;
0198           typedef typename boost::result_of<FR()>::type RR;
0199           typedef typename remove_RC<RR>::type RType;
0200           typedef RType type;
0201       };
0202 
0203       //   RTFGHXYZ == ReturnTypeFandGandHwithXYZ (used in compose)
0204       template <class F,class G,class H,class X,class Y,class Z>
0205       struct RTFGHXYZ {
0206           typedef typename remove_RC<F>::type FType;
0207           typedef typename remove_RC<G>::type GType;
0208           typedef typename remove_RC<H>::type HType;
0209           typedef typename remove_RC<X>::type XType;
0210           typedef typename remove_RC<Y>::type YType;
0211           typedef typename remove_RC<Z>::type ZType;
0212           typedef typename boost::result_of<GType(XType,YType,ZType)>::type GR;
0213           typedef typename boost::result_of<GR()>::type GRR;
0214           typedef typename remove_RC<GRR>::type GRType;
0215           typedef typename boost::result_of<HType(XType,YType,ZType)>::type HR;
0216           typedef typename boost::result_of<HR()>::type HRR;
0217           typedef typename remove_RC<HRR>::type HRType;
0218           typedef typename boost::result_of<FType(GRType,HRType)>::type FR;
0219           typedef typename boost::result_of<FR()>::type RR;
0220           typedef typename remove_RC<RR>::type RType;
0221           typedef RType type;
0222       };
0223 
0224       //   RTFGX   == ReturnTypeFandGwithX     (used in compose)
0225       template <class F,class G,class X>
0226       struct RTFGX {
0227           typedef typename remove_RC<F>::type FType;
0228           typedef typename remove_RC<G>::type GType;
0229           typedef typename remove_RC<X>::type XType;
0230           typedef typename boost::result_of<GType(XType)>::type GR;
0231           typedef typename boost::result_of<GR()>::type GRR;
0232           typedef typename remove_RC<GRR>::type GRType;
0233           typedef typename boost::result_of<FType(GRType)>::type FR;
0234           typedef typename boost::result_of<FR()>::type RR;
0235           typedef typename remove_RC<RR>::type RType;
0236           typedef RType type;
0237       };
0238 
0239       //   RTFGXY  == ReturnTypeFandGwithXY    (used in compose)
0240       template <class F,class G,class X,class Y>
0241       struct RTFGXY {
0242           typedef typename remove_RC<F>::type FType;
0243           typedef typename remove_RC<G>::type GType;
0244           typedef typename remove_RC<X>::type XType;
0245           typedef typename remove_RC<Y>::type YType;
0246           typedef typename boost::result_of<GType(XType,YType)>::type GR;
0247           typedef typename boost::result_of<GR()>::type GRR;
0248           typedef typename remove_RC<GRR>::type GRType;
0249           typedef typename boost::result_of<FType(GRType)>::type FR;
0250           typedef typename boost::result_of<FR()>::type RR;
0251           typedef typename remove_RC<RR>::type RType;
0252           typedef RType type;
0253       };
0254 
0255       //   RTFGXYZ == ReturnTypeFandGwithXYZ   (used in compose)
0256       template <class F,class G,class X,class Y,class Z>
0257       struct RTFGXYZ {
0258           typedef typename remove_RC<F>::type FType;
0259           typedef typename remove_RC<G>::type GType;
0260           typedef typename remove_RC<X>::type XType;
0261           typedef typename remove_RC<Y>::type YType;
0262           typedef typename remove_RC<Z>::type ZType;
0263           typedef typename boost::result_of<GType(XType,YType,ZType)>::type GR;
0264           typedef typename boost::result_of<GR()>::type GRR;
0265           typedef typename remove_RC<GRR>::type GRType;
0266           typedef typename boost::result_of<FType(GRType)>::type FR;
0267           typedef typename boost::result_of<FR()>::type RR;
0268           typedef typename remove_RC<RR>::type RType;
0269           typedef RType type;
0270       };
0271 
0272       // This is the way to make the return type for
0273       // map(f,l). It is used four times in the code
0274       // so I have made it a separate struct.
0275       // RTFL == ReturnTypeFunctionList
0276       template <class F,class L>
0277       struct RTFL {
0278            typedef typename remove_RC<F>::type Ftype;
0279            typedef typename result_of::ListType<L>::tail_result_type
0280                                    Ttype;
0281            typedef typename result_of::ListType<L>::value_type Vtype;
0282            // NOTE: FR is the type of the functor.
0283            typedef typename boost::result_of<Ftype(Vtype)>::type FR;
0284            // NOTE: RR is the type returned, which then needs
0285            // reference and const removal.
0286            typedef typename boost::result_of<FR()>::type RR;
0287            typedef typename remove_RC<RR>::type Rtype;
0288            typedef typename boost::remove_reference<L>::type LL;
0289            typedef typename LL::template cons_rebind<Rtype>::delay_type
0290                    type;
0291       };
0292 
0293       // RTAB == ReturnTypeListAListB
0294       template <typename LA, typename LB>
0295       struct RTAB {
0296                   typedef typename result_of::ListType<LA>::tail_result_type
0297                                    LAtype;
0298                   typedef typename result_of::ListType<LB>::tail_result_type
0299                                    LBtype;
0300                   typedef typename result_of::ListType<LA>::value_type VAA;
0301                   typedef typename boost::remove_const<VAA>::type VAtype;
0302                   typedef typename result_of::ListType<LB>::value_type VBB;
0303                   typedef typename boost::remove_const<VBB>::type VBtype;
0304                   typedef typename boost::result_of<Make_pair(VAtype,VBtype)>
0305                                   ::type FR;
0306                   typedef typename boost::result_of<FR()>::type RR;
0307                   typedef typename remove_RC<RR>::type Rtype;
0308                   typedef typename boost::remove_reference<LA>::type LLA;
0309                   typedef typename LLA::template cons_rebind<Rtype>::type type;
0310       };
0311 
0312 
0313       // RTZAB == ReturnTypeZipListAListB
0314       template <typename Z, typename LA, typename LB>
0315       struct RTZAB {
0316                   typedef typename remove_RC<Z>::type Ztype;
0317                   typedef typename result_of::ListType<LA>::tail_result_type
0318                                    LAtype;
0319                   typedef typename result_of::ListType<LB>::tail_result_type
0320                                    LBtype;
0321                   typedef typename result_of::ListType<LA>::value_type VAtype;
0322                   typedef typename result_of::ListType<LB>::value_type VBtype;
0323                   typedef typename boost::result_of<Ztype(VAtype,VBtype)>::type
0324                                    FR;
0325                   typedef typename boost::result_of<FR()>::type RR;
0326                   typedef typename remove_RC<RR>::type Rtype;
0327                   typedef typename boost::remove_reference<LA>::type LLA;
0328                   typedef typename LLA::template cons_rebind<Rtype>::type type;
0329       };
0330 
0331     }
0332   }
0333 }
0334 
0335 #endif