Opened 10 years ago

Last modified 9 years ago

#8442 new Feature Requests

Match std::reference_wrapper functionality

Reported by: Nathan Crookston <nathan.crookston+boost@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: bind
Version: Boost Development Trunk Severity: Problem
Keywords: reference_wrapper Cc:

Description

boost::reference_wrapper lacks the ability to forward calls the referenced type's operator(), e.g.:

#include <boost/ref.hpp>
#include <functional>
#include <iostream>

int main()
{
  auto f = [] { std::cout << "Here" << std::endl; };
  //auto rf = boost::ref(f); //No operator() overload.
  auto rf = std::ref(f);

  f();
  rf();

  return 0;
}

There are a few other related differences with the standard, e.g. std::reference_wrapper inherits from std::{binary|unary}_function, may have value_type, etc.

Change History (1)

comment:1 by viboes, 9 years ago

Component: Nonebind
Owner: set to Peter Dimov
Note: See TracTickets for help on using tickets.