GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::is_bind_expression(3) C++ Standard Libary std::is_bind_expression(3)

std::is_bind_expression - std::is_bind_expression


Defined in header <functional>
template< class T > (since C++11)
struct is_bind_expression;


If T is the type produced by a call to std::bind, this template is derived from
std::true_type. For any other type, this template is derived from std::false_type.


This template may be specialized for a user-defined type T to implement
UnaryTypeTrait with base characteristic of std::true_type to indicate that T should
be treated by std::bind as if it were the type of a bind subexpression: when a
bind-generated function object is invoked, a bound argument of this type will be
invoked as a function object and will be given all the unbound arguments passed to
the bind-generated object.


Helper variable template


template< class T >
inline constexpr bool is_bind_expression_v = (since C++17)
is_bind_expression<T>::value;

Inherited from std::integral_constant


value true if T is a function object generated by std::bind, false otherwise
[static] (public static member constant)


operator bool converts the object to bool, returns value
(public member function)
operator() returns value
(C++14) (public member function)


Type Definition
value_type bool
type std::integral_constant<bool, value>

// Run this code


#include <iostream>
#include <type_traits>
#include <functional>


struct MyBind {
typedef int result_type;
int operator()(int a, int b) const { return a + b; }
};


namespace std {
template<>
struct is_bind_expression<MyBind> : public true_type {};
}


int f(int n1, int n2)
{
return n1+n2;
}


int main()
{
// as if bind(f, bind(MyBind(), _1, _2), 2)
auto b = std::bind(f, MyBind(), 2);


std::cout << "Adding 2 to the sum of 10 and 11 gives " << b(10, 11) << '\n';
}


Adding 2 to the sum of 10 and 11 gives 23


bind binds one or more arguments to a function object
(C++11) (function template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.