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 distance

boost::proto::functional::distance — A PolymorphicFunctionObject type that invokes the std::distance() function on its arguments.

Synopsis

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


struct distance :  proto::callable {
  // member classes/structs/unions
  template<typename This, typename InputIterator> 
  struct result<This(InputIterator, InputIterator)> {
    // types
    typedef typename std::iterator_traits<
      typename boost::remove_const<
        typename boost::remove_reference<InputIterator>::type
      >::type
    >::difference_type type;
  };

  // public member functions
  template<typename InputIterator> 
    void operator()(InputIterator, InputIterator) const;
};

Description

A PolymorphicFunctionObject type that invokes the std::distance() function on its arguments.

distance public member functions

  1. template<typename InputIterator> 
      void operator()(InputIterator first, InputIterator last) const;

    Returns:

    std::distance(first, last)


PrevUpHomeNext