functional
标准库标头<functional>
此标头是功能对象库,并提供标准散列函数...
命名空间
placeholders | Defines placeholders for the unbound arguments in a std::bind expression |
---|
常数
在命名空间std::占位符中定义
[医]1,[医]2,[医]3、[医]4,...%28C++11%29占位符用于std::binding表达式%28常数%29中的未绑定参数
班
function (C++11) | wraps callable object of any type with specified function call signature (class template) |
---|---|
mem_fn (C++11) | creates a function object out of a pointer to a member (function template) |
bad_function_call (C++11) | the exception thrown when invoking an empty std::function (class) |
is_bind_expression (C++11) | indicates that an object is std::bind expression or can be used as one (class template) |
is_placeholder (C++11) | indicates that an object is a standard placeholder or can be used as one (class template) |
reference_wrapper (C++11) | CopyConstructible and CopyAssignable reference wrapper (class template) |
散列
散列%28C++11%29散列函数对象%28类模板%29
模板<>结构散列<bool>;模板<>结构散列<char>;模板<>结构散列<signed char>;模板<>结构散列<unsigned char>;模板<>结构散列<char16[医]模板<>结构散列<char32[医]模板<>结构散列<wchar[医]模板<>结构散列<short>;模板<>结构散列<unsigned short>;模板<>结构散列<int>;模板<>结构散列<unsigned int>;模板<>结构散列<long>;模板<>结构散列<long long>;模板<>结构散列<unsigned long>;模板<>结构散列<unsigned long long>;模板<>结构散列<float>;模板<>结构散列<double>;模板<>结构散列<long double>;模板<类T>结构散列<T%2A>;std::内置类型的散列专门化%28类模板专门化%29
功能
bind (C++11) | binds one or more arguments to a function object (function template) |
---|---|
refcref (C++11)(C++11) | creates a std::reference_wrapper with a type deduced from its argument (function template) |
invoke (C++17) | invokes any Callable object with given arguments (function template) |
功能对象
算术运算
*。
+函数对象实现x+y%28类模板%29
减号函数对象实现x-y%28类模板%29
实现x的乘法函数对象%2AY%28类模板%29
划分函数对象实现x/y%28类模板%29
模数函数对象实现x%y%28类模板%29
否定函数对象实现-x%28类模板%29
比较
平等[医]函数对象实现x==y%28类模板%29
不[医]平等[医]函数对象实现x%21=y%28类模板%29
实现x>y%28类模板%29的更大函数对象
减去实现x<y%28类模板%29的函数对象
更大[医]实现x>=y%28类模板%29的等函数对象
减[医]实现x<=y%28类模板%29的等函数对象
逻辑运算
逻辑[医]和函数对象实现x&y%28类模板%29
逻辑[医]或实现x的函数对象Y%28类模板%29
逻辑[医]非函数对象实现%21x%28类模板%29
按位运算
钻头[医]和函数对象实现x&y%28类模板%29
钻头[医]或实现x的函数对象Y%28类模板%29
钻头[医]XOR函数对象实现x^y%28类模板%29
钻头[医]非%28C++14%29函数对象实现~x%28类模板%29
否定词
不[医]fn%28C++17%29创建一个函数对象,该对象返回函数对象的结果的补码,它持有%28函数模板%29。
一元[医]否定%28不推荐%29包装函数对象,返回包含%28类模板%29的一元谓词的补码
二进制[医]否定%28不推荐的%29包装函数对象,返回二进制谓词的补码,它包含%28类模板%29
Not 1%28不推荐使用%29构造自定义std::unary[医]否定对象%28函数模板%29
不是2%28不推荐使用%29构造自定义STD::二进制[医]否定对象%28函数模板%29
搜索者
违约[医]搜索器%28C++17%29标准C++库搜索算法实现%28类模板%29
博耶[医]摩尔[医]搜索器%28C++17%29 Boyer-Moore搜索算法实现%28类模板%29
博耶[医]摩尔[医]霍波尔[医]搜索器%28C++17%29 Boyer-Moore-Horspool搜索算法实现%28类模板%29
在C++11中被弃,在C++17中删除
底座
*。
一元[医]函数%28,直到C++17%29适配器-兼容一元函数基类%28类模板%29
二进制[医]函数%28直到C++17%29适配器兼容二进制函数基类%28类模板%29
粘结剂
绑定1 stbinder2%28直到C++17%29%28直到C++17%29函数对象持有一个二进制函数和它的一个参数%28类模板%29
绑定1stbind2%28直到C++17%29%28直到C++17%29将一个参数绑定到二进制函数%28函数模板%29
功能适配器
指针[医]到[医]一元[医]函数%28,直到C++17%29适配器与指针指针的兼容包装器%28类模板%29
指针[医]到[医]二进制[医]函数%28,直到C++17%29适配器-兼容指针到二进制函数%28类模板%29的包装器
PTR[医]乐趣%28,直到C++17%29从指向函数%28的指针创建一个与适配器兼容的函数对象包装器%29。
米姆[医]乐趣[医]TMEM[医]漏斗1[医]康斯特[医]米姆[医]乐趣[医]康斯特[医]米姆[医]漏斗1[医]直到C++17%29%28直到C++17%29%28直到C++17%29%28直到C++17%29包装器用于指针指向髓或一元成员函数,可以用指针调用对象%28类模板%29
米姆[医]在C++17%29创建指向成员函数的指针的包装器之前,使用指向对象%28函数模板%29的指针调用
米姆[医]乐趣[医]参考文献[医]TMEM[医]漏斗1[医]参考文献[医]康斯特[医]米姆[医]乐趣[医]参考文献[医]康斯特[医]米姆[医]漏斗1[医]参考文献[医]直到C++17%29%28直到C++17%29%28直到C++17%29%28直到C++17%29包装器指针指向髓或一元成员函数,可以调用对象%28类模板%29
米姆[医]乐趣[医]在C++17%29创建指向成员函数的指针的包装器之前,引用对象%28函数模板%29调用
简介
二次
namespace std {
// invoke:
template <class F, class... Args>
invoke_result_t<F, Args...> invoke(F&& f, Args&&... args
// reference_wrapper:
template <class T> class reference_wrapper;
template <class T> reference_wrapper<T> ref(T&) noexcept;
template <class T> reference_wrapper<const T> cref(const T&) noexcept;
template <class T> void ref(const T&&) = delete;
template <class T> void cref(const T&&) = delete;
template <class T> reference_wrapper<T> ref(reference_wrapper<T>) noexcept;
template <class T> reference_wrapper<const T> cref(reference_wrapper<T>) noexcept;
// arithmetic operations:
template <class T = void> struct plus;
template <class T = void> struct minus;
template <class T = void> struct multiplies;
template <class T = void> struct divides;
template <class T = void> struct modulus;
template <class T = void> struct negate;
template <> struct plus<void>;
template <> struct minus<void>;
template <> struct multiplies<void>;
template <> struct divides<void>;
template <> struct modulus<void>;
template <> struct negate<void>;
// comparisons:
template <class T = void> struct equal_to;
template <class T = void> struct not_equal_to;
template <class T = void> struct greater;
template <class T = void> struct less;
template <class T = void> struct greater_equal;
template <class T = void> struct less_equal;
template <> struct equal_to<void>;
template <> struct not_equal_to<void>;
template <> struct greater<void>;
template <> struct less<void>;
template <> struct greater_equal<void>;
template <> struct less_equal<void>;
// logical operations:
template <class T = void> struct logical_and;
template <class T = void> struct logical_or;
template <class T = void> struct logical_not;
template <> struct logical_and<void>;
template <> struct logical_or<void>;
template <> struct logical_not<void>;
// bitwise operations:
template <class T = void> struct bit_and;
template <class T = void> struct bit_or;
template <class T = void> struct bit_xor;
template <class T = void> struct bit_not;
template <> struct bit_and<void>;
template <> struct bit_or<void>;
template <> struct bit_xor<void>;
template <> struct bit_not<void>;
// function template not_fn:
template <class F> /*unspecified*/ not_fn(F&& f
// bind:
template<class T> struct is_bind_expression;
template<class T> struct is_placeholder;
template<class F, class... BoundArgs>
/*unspecified*/ bind(F&&, BoundArgs&&...
template<class R, class F, class... BoundArgs>
/*unspecified*/ bind(F&&, BoundArgs&&...
namespace placeholders {
// M is the implementation-defined number of placeholders
/* implementation-defined */ _1;
/* implementation-defined */ _2;
...
/* implementation-defined */ _M;
}
// member function adaptors:
template<class R, class T> /*unspecified*/ mem_fn(R T::*) noexcept;
// polymorphic function wrappers:
class bad_function_call;
template<class> class function; // undefined
template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
template<class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&
template<class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template<class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
// searchers:
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
class default_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher;
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
default_searcher<ForwardIterator, BinaryPredicate>
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate()
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_searcher(RandomAccessIterator pat_first,
RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_horspool_searcher(RandomAccessIterator pat_first,
RandomAccessIterator pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate()
// hash function primary template:
template <class T> struct hash;
// function object binders:
template <class T> inline constexpr bool is_bind_expression_v
= is_bind_expression<T>::value;
template <class T> inline constexpr int is_placeholder_v
= is_placeholder<T>::value;
}
二次
类std::reference_wrapper
二次
namespace std {
template <class T> class reference_wrapper {
public :
// types
using type = T;
// construct/copy/destroy
reference_wrapper(T&) noexcept;
reference_wrapper(T&&) = delete; // do not bind to temporary objects
reference_wrapper(const reference_wrapper& x) noexcept;
// assignment
reference_wrapper& operator=(const reference_wrapper& x) noexcept;
// access
operator T& () const noexcept;
T& get() const noexcept;
// invocation
template <class... ArgTypes>
invoke_result_t<T&, ArgTypes...> operator() (ArgTypes&&...) const;
};
}
二次
类std::is_bind_expression
二次
namespace std {
template<class T> struct is_bind_expression;
}
二次
类std::is_placeholder
二次
namespace std {
template<class T> struct is_placeholder;
}
二次
类std::bad_function_call
二次
class bad_function_call : public std::exception {
public:
// constructor:
bad_function_call() noexcept;
};
二次
类std::function
二次
namespace std {
template<class> class function; // undefined
template<class R, class... ArgTypes>
class function<R(ArgTypes...)> {
public:
using result_type = R;
// construct/copy/destroy:
function() noexcept;
function(nullptr_t) noexcept;
function(const function&
function(function&&
template<class F> function(F
function& operator=(const function&
function& operator=(function&&
function& operator=(nullptr_t) noexcept;
template<class F> function& operator=(F&&
template<class F> function& operator=(reference_wrapper<F>) noexcept;
~function(
// function modifiers:
void swap(function&) noexcept;
// function capacity:
explicit operator bool() const noexcept;
// function invocation:
R operator()(ArgTypes...) const;
// function target access:
const type_info& target_type() const noexcept;
template<class T> T* target() noexcept;
template<class T> const T* target() const noexcept;
};
// Null pointer comparisons:
template <class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template <class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template <class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template <class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
// specialized algorithms:
template <class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&
}
二次
另见
Specializes std::hash for std::string, std::u16string, std::u32string, std::wstring | |
---|---|
<system_error> | Specializes std::hash for std::error_code |
<bitset> | Specializes std::hash for std::bitset |
<memory> | Specializes std::hash for std::unique_ptr, std::shared_ptr |
<typeindex> | Specializes std::hash for std::type_index |
<vector> | Specializes std::hash for std::vector<bool> |
<thread> | Specializes std::hash for std::thread::id |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。