MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::FunctionRef< R(Args...)> Class Template Reference

Simplified implementation of std::function_ref from C++26. More...

#include <MRFunctional.h>

Public Member Functions

constexpr FunctionRef () noexcept=delete
 
constexpr FunctionRef (const FunctionRef &rhs) noexcept=default
 
template<typename F , std::enable_if_t< std::is_invocable_r_v< R, F &&, Args... > > * = nullptr>
constexpr FunctionRef (F &&f) noexcept
 
constexpr FunctionRefoperator= (const FunctionRef &rhs) noexcept=default
 
template<typename F , std::enable_if_t< std::is_invocable_r_v< R, F &&, Args... > > * = nullptr>
constexpr FunctionRefoperator= (F &&f) noexcept
 
constexpr void swap (FunctionRef &rhs) noexcept
 
operator() (Args... args) const
 

Detailed Description

template<typename R, typename... Args>
class MR::FunctionRef< R(Args...)>

Simplified implementation of std::function_ref from C++26.

FunctionRef can be used as a lightweight replacement for std::function in cases when:

  • a callable exists (there's no equivalent to std::function( nullptr ))
  • a callable is passed to a function that calls it immediately or passes to another function of the same kind

The documentation for this class was generated from the following file: