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

PrevUpHomeNext

Struct first

boost::proto::functional::first — A PolymorphicFunctionObject type that returns the first element of a std::pair<>.

Synopsis

// In header: <boost/proto/functional/std/utility.hpp>


struct first :  proto::callable {
  // member classes/structs/unions
  template<typename This, typename Pair> 
  struct result<This(Pair)> {
    // types
    typedef typename Pair::first_type type;
  };
  template<typename This, typename Pair> 
  struct result<This(Pair &)> {
    // types
    typedef typename Pair::first_type & type;
  };
  template<typename This, typename Pair> 
  struct result<This(Pair const &)> {
    // types
    typedef typename Pair::first_type const & type;
  };

  // public member functions
  template<typename Pair> typename Pair::first_type & operator()(Pair &) const;
  template<typename Pair> 
    typename Pair::first_type const & operator()(Pair const &) const;
};

Description

A PolymorphicFunctionObject type that returns the first element of a std::pair<>.

first public member functions

  1. template<typename Pair> 
      typename Pair::first_type & operator()(Pair & pair) const;

    Returns:

    pair.first

  2. template<typename Pair> 
      typename Pair::first_type const & operator()(Pair const & pair) const;

    Returns:

    pair.first


PrevUpHomeNext