Opened 5 years ago

Last modified 5 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 Changed 5 years ago by viboes

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