Boost logo

Boost Users :

Subject: [Boost-users] [Boost.function_types] Function synthesis and property tags
From: Yury Korobkin (yuryk_at_[hidden])
Date: 2009-08-24 04:12:05


Hi, everybody.

I'm trying to synthesize a function type G from another function type F
with some changes on return and arg types. What I need to leave
constant, are all these additional properties that are returned by
components<F>::tag. I want them all as a bunch, don't really fancy
querying them one by one, they sorta look contradictive or at least
redundant.

The naive approach of passing the same tag to the function_type<Seq,
Tag> does not make a change -
it leads to the same result as if default null_tag were passed.

How do you generate a function type with the same additional properties
as the given one?

 

Sample code:
//----------------------------------------------------------------------
----------------------------

typedef int (__stdcall * pF)(char);

typedef int ( * pG)(char);

 

typedef remove_pointer<pF>::type F;

typedef components<F> compsF;

 

// generate type hopefully like pF

typedef function_pointer<compsF,

                             //create tag from mask and bits

                             detail::property_tag<compsF::bits::value,
compsF::mask::value>

>::type pfn_gen;

 

BOOST_MPL_ASSERT((is_same<pfn_gen, pG>)); // this one
passes, should fail, though

BOOST_MPL_ASSERT((is_same<pfn_gen, pF>)); // I wish,
but fails

//----------------------------------------------------------------------
----------------------------

 

Thanks,

YuryK

This mail was received via Mail-SeCure System. STATEMENT OF CONFIDENTIALITY The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify Exent Technologies Ltd. immediately at +972-3-9243828 or by reply e-mail and destroy all copies of this message and any attachments



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net