Boost logo

Boost Users :

Subject: [Boost-users] [boost-users][function_types] Function synthesis and property tags
From: yuryk (yuryk_at_[hidden])
Date: 2009-08-27 03:20:12


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 remain 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 all one by one,
they sorta look contradictive or at least redundant.

The simple 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 null_tag were passed.

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

Sample code:
//--------------------------------------------------------------------------------------------------
typedef int (__stdcall * pfn1)(char);
typedef int ( * pfn2)(char);

typedef remove_pointer<pfn1>::type fn1;
typedef ft::components<fn1> comps1;

// generate type hopefully like pfn1
typedef ft::function_pointer<comps1,
                             //create tag from mask and bits
                             ft::detail::property_tag<comps1::bits::value,
comps1::mask::value>
>::type pfn_gen1;

BOOST_MPL_ASSERT((is_same<pfn_gen1, pfn2>)); // this one
passes, should fail, though
BOOST_MPL_ASSERT((is_same<pfn_gen1, pfn1>)); // I wish,
but fails

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

-- 
View this message in context: http://www.nabble.com/-boost-users--function_types--Function-synthesis-and-property-tags-tp25103189p25103189.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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