Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template noinvoke

boost::proto::noinvoke — A type annotation in an ObjectTransform which instructs Proto not to look for a nested ::type within T after type substitution.

Synopsis

// In header: <boost/proto/transform/make.hpp>

template<typename T> 
struct noinvoke {
};

Description

ObjectTransforms are evaluated by proto::make<>, which finds all nested transforms and replaces them with the result of their applications. If any substitutions are performed, the result is first assumed to be a metafunction to be applied; that is, Proto checks to see if the result has a nested ::type typedef. If it does, that becomes the result. The purpose of proto::noinvoke<> is to prevent Proto from looking for a nested ::type typedef in these situations.

Example:

struct Test
  : proto::when<
        _
      , proto::noinvoke<
            // This remove_pointer invocation is bloked by noinvoke
            boost::remove_pointer<
                // This add_pointer invocation is *not* blocked by noinvoke
                boost::add_pointer<_>
            >
        >()
    >
{};

void test_noinvoke()
{
    typedef proto::terminal<int>::type Int;
    
    BOOST_MPL_ASSERT((
        boost::is_same<
            boost::result_of<Test(Int)>::type
          , boost::remove_pointer<Int *>
        >
    ));
    
    Int i = {42};
    boost::remove_pointer<Int *> t = Test()(i);
}


PrevUpHomeNext