標準ライブラリヘッダ <functional>
提供: cppreference.com
このヘッダは関数オブジェクトライブラリの一部であり、標準のハッシュ関数を提供します。
[編集]名前空間
placeholders | std::bind 式で束縛されない引数に対するプレースホルダを定義します |
定数 | |
名前空間 std::placeholders で定義 | |
(C++11) | std::bind 式におけるバインドされない引数のためのプレースホルダ (定数) |
[編集]クラス
(C++11) | 指定された関数呼び出しシグネチャを持つ任意の型の呼び出し可能なオブジェクトをラップします (クラステンプレート) |
(C++11) | メンバポインタから関数オブジェクトを作成します (関数テンプレート) |
(C++11) | 空の std::function を呼び出したときに投げられる例外 (クラス) |
(C++11) | オブジェクトが std::bind 式であるか、 std::bind 式として使用できることを表します (クラステンプレート) |
(C++11) | オブジェクトが標準のプレースホルダであるか、プレースホルダとして使用できることを表します (クラステンプレート) |
(C++11) | CopyConstructible かつ CopyAssignable な参照ラッパー (クラステンプレート) |
ハッシュ | |
(C++11) | ハッシュ関数オブジェクト (クラステンプレート) |
template<>struct hash<bool>; | 組み込み型に対する std::hash の特殊化 (クラステンプレートの特殊化) |
[編集]関数
(C++20) | 可変個の引数を順番通りに関数オブジェクトに束縛します (関数テンプレート) |
(C++11) | 関数オブジェクトに1つ以上の引数をバインドします (関数テンプレート) |
(C++11)(C++11) | 引数から推定される型の std::reference_wrapper を作成します (関数テンプレート) |
(C++17) | 任意の Callable なオブジェクトを指定された引数で呼びます (関数テンプレート) |
[編集]関数オブジェクト
算術演算 | |
x + y を実装する関数オブジェクト (クラステンプレート) | |
x - y を実装する関数オブジェクト (クラステンプレート) | |
x * y を実装する関数オブジェクト (クラステンプレート) | |
x / y を実装する関数オブジェクト (クラステンプレート) | |
x % y を実装する関数オブジェクト (クラステンプレート) | |
-x を実装する関数オブジェクト (クラステンプレート) | |
比較 | |
x == y を実装する関数オブジェクト (クラステンプレート) | |
x != y を実装する関数オブジェクト (クラステンプレート) | |
x > y を実装する関数オブジェクト (クラステンプレート) | |
x < y を実装する関数オブジェクト (クラステンプレート) | |
x >= y を実装する関数オブジェクト (クラステンプレート) | |
x <= y を実装する関数オブジェクト (クラステンプレート) | |
コンセプト制約付き比較 | |
(C++20) | x == y を実装する関数オブジェクト (クラス) |
(C++20) | x != y を実装する関数オブジェクト (クラス) |
(C++20) | x > y を実装する関数オブジェクト (クラス) |
(C++20) | x < y を実装する関数オブジェクト (クラス) |
(C++20) | x >= y を実装する関数オブジェクト (クラス) |
(C++20) | x <= y を実装する関数オブジェクト (クラス) |
論理演算 | |
x && y を実装する関数オブジェクト (クラステンプレート) | |
x || y を実装する関数オブジェクト (クラステンプレート) | |
!x を実装する関数オブジェクト (クラステンプレート) | |
ビット単位の演算 | |
x & y を実装する関数オブジェクト (クラステンプレート) | |
x | y を実装する関数オブジェクト (クラステンプレート) | |
x ^ y を実装する関数オブジェクト (クラステンプレート) | |
(C++14) | ~x を実装する関数オブジェクト (クラステンプレート) |
否定 | |
(C++17) | 保持する関数オブジェクトの結果の否定を返す関数オブジェクトを作成します (関数テンプレート) |
検索 | |
(C++17) | 標準 C++ ライブラリの検索アルゴリズムの実装 (クラステンプレート) |
(C++17) | ボイヤー・ムーア検索アルゴリズムの実装 (クラステンプレート) |
ボイヤー・ムーア・ホースプール検索アルゴリズムの実装 (クラステンプレート) |
[編集]C++11 で非推奨になり C++17 で削除されたクラスおよび関数
基本 | |
(C++11で非推奨)(C++17で削除) | アダプタ互換な単項関数の基底クラス (クラステンプレート) |
(C++11で非推奨)(C++17で削除) | アダプタ互換な二項関数の基底クラス (クラステンプレート) |
バインダ | |
(C++11で非推奨)(C++17で削除) | 二項引数とその引数の1つを保持する関数オブジェクト (クラステンプレート) |
(C++11で非推奨)(C++17で削除) | 二項関数に引数を1つ束縛します (関数テンプレート) |
関数アダプタ | |
(C++11で非推奨)(C++17で削除) | 単項関数へのポインタに対するアダプタ互換なラッパー (クラステンプレート) |
(C++11で非推奨)(C++17で削除) | 二項関数へのポインタに対するアダプタ互換なラッパー (クラステンプレート) |
(C++11で非推奨)(C++17で削除) | 関数ポインタからアダプタ互換な関数オブジェクトを作成します (関数テンプレート) |
(C++11で非推奨)(C++17で削除) | オブジェクトへのポインタを使用して呼ぶことができる、引数なしまたは引数1個のメンバ関数へのポインタに対するラッパー (クラステンプレート) |
(C++11で非推奨)(C++17で削除) | メンバ関数ポインタから、オブジェクトへのポインタを使用して呼ぶことができるラッパーを作成します (関数テンプレート) |
(C++11で非推奨)(C++17で削除) | オブジェクトへの参照を使用して呼ぶことができる、引数なしまたは引数1個のメンバ関数へのポインタに対するラッパー (クラステンプレート) |
(C++11で非推奨)(C++17で削除) | メンバ関数ポインタから、オブジェクトへの参照を使用して呼ぶことができるラッパーを作成します (関数テンプレート) |
[編集]C++17 で非推奨になり C++20 で削除されたクラスおよび関数
否定 | |
(C++17で非推奨)(C++20で削除) | 保持する単項述語の否定を返すラッパー関数オブジェクト (クラステンプレート) |
(C++17で非推奨)(C++20で削除) | 保持する二項述語の否定を返すラッパー関数オブジェクト (クラステンプレート) |
(C++17で非推奨)(C++20で削除) | カスタム std::unary_negate オブジェクトを構築します (関数テンプレート) |
(C++17で非推奨)(C++20で削除) | カスタム std::binary_negate オブジェクトを構築します (関数テンプレート) |
[編集]概要
namespace std {// invoketemplate<class F, class... Args>constexpr invoke_result_t<F, Args...> invoke(F&& f, Args&&... args)noexcept(is_nothrow_invocable_v<F, Args...>); // reference_wrappertemplate<class T>class reference_wrapper; template<class T>constexpr reference_wrapper<T> ref(T&)noexcept;template<class T>constexpr 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>constexpr reference_wrapper<T> ref(reference_wrapper<T>)noexcept;template<class T>constexpr reference_wrapper<const T> cref(reference_wrapper<T>)noexcept; template<class T>struct unwrap_reference;template<class T>using unwrap_reference_t =typename unwrap_reference<T>::type;template<class T>struct unwrap_ref_decay;template<class T>using unwrap_ref_decay_t =typename unwrap_ref_decay<T>::type; // arithmetic operationstemplate<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>; // comparisonstemplate<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 operationstemplate<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 operationstemplate<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>; // identitystruct identity; // function template not_fntemplate<class F>constexpr/* unspecified */ not_fn(F&& f); // function template bind_fronttemplate<class F, class... Args>constexpr/* unspecified */ bind_front(F&&, Args&&...); // bindtemplate<class T>struct is_bind_expression;template<class T>struct is_placeholder; template<class F, class... BoundArgs>constexpr/* unspecified */ bind(F&&, BoundArgs&&...);template<class R, class F, class... BoundArgs>constexpr/* unspecified */ bind(F&&, BoundArgs&&...); namespace placeholders {// M is the implementation-defined number of placeholders/* see description */ _1;/* see description */ _2; . . . /* see description */ _M;} // member function adaptorstemplate<class R, class T>constexpr/* unspecified */ mem_fn(R T::*)noexcept; // polymorphic function wrappersclass bad_function_call; template<class>class function;// not definedtemplate<class R, class... ArgTypes>class function<R(ArgTypes...)>; template<class R, class... ArgTypes>void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&)noexcept; template<class R, class... ArgTypes>bool operator==(const function<R(ArgTypes...)>&, nullptr_t)noexcept; // searcherstemplate<class ForwardIter, class BinaryPredicate = equal_to<>>class default_searcher; template<class RandomAccessIter, class Hash = hash<typename iterator_traits<RandomAccessIter>::value_type>, class BinaryPredicate = equal_to<>>class boyer_moore_searcher; template<class RandomAccessIter, class Hash = hash<typename iterator_traits<RandomAccessIter>::value_type>, class BinaryPredicate = equal_to<>>class boyer_moore_horspool_searcher; // hash function primary templatetemplate<class T>struct hash; // function object binderstemplate<class T>inlineconstexprbool is_bind_expression_v = is_bind_expression<T>::value;template<class T>inlineconstexprint is_placeholder_v = is_placeholder<T>::value; namespace ranges {// concept-constrained comparisonsstruct equal_to;struct not_equal_to;struct greater;struct less;struct greater_equal;struct less_equal;}}
[編集]クラステンプレート std::reference_wrapper
namespace std {template<class T>class reference_wrapper {public:// typesusing type = T; // construct/copy/destroytemplate<class U>constexpr reference_wrapper(U&&)noexcept(see below);constexpr reference_wrapper(const reference_wrapper& x)noexcept; // assignmentconstexpr reference_wrapper& operator=(const reference_wrapper& x)noexcept; // accessconstexpr operator T&()constnoexcept;constexpr T& get()constnoexcept; // invocationtemplate<class... ArgTypes>constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...)const;};template<class T> reference_wrapper(T&)-> reference_wrapper<T>;}
[編集]クラステンプレート std::unwrap_reference
namespace std {template<class T>struct unwrap_reference;}
[編集]クラステンプレート std::unwrap_ref_decay
namespace std {template<class T>struct unwrap_ref_decay;}
[編集]クラステンプレート std::plus
namespace std {template<class T =void>struct plus {constexpr T operator()(const T& x, const T& y)const;}; template<>struct plus<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)+std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::minus
namespace std {template<class T =void>struct minus {constexpr T operator()(const T& x, const T& y)const;}; template<>struct minus<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)-std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::multiplies
namespace std {template<class T =void>struct multiplies {constexpr T operator()(const T& x, const T& y)const;}; template<>struct multiplies<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)*std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::divides
namespace std {template<class T =void>struct divides {constexpr T operator()(const T& x, const T& y)const;}; template<>struct divides<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)/std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::modulus
namespace std {template<class T =void>struct modulus {constexpr T operator()(const T& x, const T& y)const;}; template<>struct modulus<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)%std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::negate
namespace std {template<class T =void>struct negate {constexpr T operator()(const T& x)const;}; template<>struct negate<void>{template<class T>constexprauto operator()(T&& t)const-> decltype(-std::forward<T>(t)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::equal_to
namespace std {template<class T =void>struct equal_to {constexprbool operator()(const T& x, const T& y)const;}; template<>struct equal_to<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)==std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::not_equal_to
namespace std {template<class T =void>struct not_equal_to {constexprbool operator()(const T& x, const T& y)const;}; template<>struct not_equal_to<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)!=std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::greater
namespace std {template<class T =void>struct greater {constexprbool operator()(const T& x, const T& y)const;}; template<>struct greater<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)>std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::less
namespace std {template<class T =void>struct less {constexprbool operator()(const T& x, const T& y)const;}; template<>struct less<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)<std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::greater_equal
namespace std {template<class T =void>struct greater_equal {constexprbool operator()(const T& x, const T& y)const;}; template<>struct greater_equal<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)>=std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::less_equal
namespace std {template<class T =void>struct less_equal {constexprbool operator()(const T& x, const T& y)const;}; template<>struct less_equal<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)<=std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラス std::ranges::equal_to
namespace std::ranges{struct equal_to {template<class T, class U> requires equality_comparable_with<T, U>||/*BUILTIN-PTR-CMP*/(T, ==, U)constexprbool operator()(T&& t, U&& u)const; using is_transparent =/* unspecified */;};}
[編集]クラス std::ranges::not_equal_to
namespace std::ranges{struct not_equal_to {template<class T, class U> requires equality_comparable_with<T, U>||/*BUILTIN-PTR-CMP*/(T, ==, U)constexprbool operator()(T&& t, U&& u)const; using is_transparent =/* unspecified */;};}
[編集]クラス std::ranges::greater
namespace std::ranges{struct greater {template<class T, class U> requires totally_ordered_with<T, U>||/*BUILTIN-PTR-CMP*/(U, <, T)constexprbool operator()(T&& t, U&& u)const; using is_transparent =/* unspecified */;};}
[編集]クラス std::ranges::less
namespace std::ranges{struct less {template<class T, class U> requires totally_ordered_with<T, U>||/*BUILTIN-PTR-CMP*/(T, <, U)constexprbool operator()(T&& t, U&& u)const; using is_transparent =/* unspecified */;};}
[編集]クラス std::ranges::greater_equal
namespace std::ranges{struct greater_equal {template<class T, class U> requires totally_ordered_with<T, U>||/*BUILTIN-PTR-CMP*/(T, <, U)constexprbool operator()(T&& t, U&& u)const; using is_transparent =/* unspecified */;};}
[編集]クラス std::ranges::less_equal
namespace std::ranges{struct less_equal {template<class T, class U> requires totally_ordered_with<T, U>||/*BUILTIN-PTR-CMP*/(U, <, T)constexprbool operator()(T&& t, U&& u)const; using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::logical_and
namespace std {template<class T =void>struct logical_and {constexprbool operator()(const T& x, const T& y)const;}; template<>struct logical_and<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)&&std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::logical_or
namespace std {template<class T =void>struct logical_or {constexprbool operator()(const T& x, const T& y)const;}; template<>struct logical_or<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)||std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::logical_not
namespace std {template<class T =void>struct logical_not {constexprbool operator()(const T& x)const;}; template<>struct logical_not<void>{template<class T>constexprauto operator()(T&& t)const-> decltype(!std::forward<T>(t)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::bit_and
namespace std {template<class T =void>struct bit_and {constexpr T operator()(const T& x, const T& y)const;}; template<>struct bit_and<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)&std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::bit_or
namespace std {template<class T =void>struct bit_or {constexpr T operator()(const T& x, const T& y)const;}; template<>struct bit_or<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)|std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::bit_xor
namespace std {template<class T =void>struct bit_xor {constexpr T operator()(const T& x, const T& y)const;}; template<>struct bit_xor<void>{template<class T, class U>constexprauto operator()(T&& t, U&& u)const-> decltype(std::forward<T>(t)^std::forward<U>(u)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::bit_not
namespace std {template<class T =void>struct bit_not {constexpr T operator()(const T& x)const;}; template<>struct bit_not<void>{template<class T>constexprauto operator()(T&& t)const-> decltype(~std::forward<T>(t)); using is_transparent =/* unspecified */;};}
[編集]クラステンプレート std::identity
namespace std {struct identity {template<class T>constexpr T&& operator()(T&& t)constnoexcept; using is_transparent =/* unspecified */;};}
[編集]クラステンプレート 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
namespace std {class bad_function_call :public exception {public:// see [exception] for the specification of the special member functionsconstchar* what()constnoexcept override;};}
[編集]クラス std::function
namespace std {template<class>class function;// not defined 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&&)noexcept;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 modifiersvoid swap(function&)noexcept; // function capacityexplicit operator bool()constnoexcept; // function invocation R operator()(ArgTypes...)const; // function target accessconst type_info& target_type()constnoexcept;template<class T> T* target()noexcept;template<class T>const T* target()constnoexcept;}; template<class R, class... ArgTypes> function(R(*)(ArgTypes...))-> function<R(ArgTypes...)>; template<class F> function(F)-> function</* see description */>; // null pointer comparison functionstemplate<class R, class... ArgTypes>bool operator==(const function<R(ArgTypes...)>&, nullptr_t)noexcept; // specialized algorithmstemplate<class R, class... ArgTypes>void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&)noexcept;}
[編集]クラステンプレート std::default_searcher
namespace std {template<class ForwardIter1, class BinaryPredicate = equal_to<>>class default_searcher {public:constexpr default_searcher(ForwardIter1 pat_first, ForwardIter1 pat_last, BinaryPredicate pred = BinaryPredicate()); template<class ForwardIter2>constexpr pair<ForwardIter2, ForwardIter2> operator()(ForwardIter2 first, ForwardIter2 last)const; private: ForwardIter1 pat_first_;// exposition only ForwardIter1 pat_last_;// exposition only BinaryPredicate pred_;// exposition only};}
[編集]クラステンプレート std::boyer_moore_searcher
namespace std {template<class RandomAccessIter1, class Hash = hash<typename iterator_traits<RandomAccessIter1>::value_type>, class BinaryPredicate = equal_to<>>class boyer_moore_searcher {public: boyer_moore_searcher(RandomAccessIter1 pat_first, RandomAccessIter1 pat_last, Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); template<class RandomAccessIter2> pair<RandomAccessIter2, RandomAccessIter2> operator()(RandomAccessIter2 first, RandomAccessIter2 last)const; private: RandomAccessIter1 pat_first_;// exposition only RandomAccessIter1 pat_last_;// exposition only Hash hash_;// exposition only BinaryPredicate pred_;// exposition only};}
[編集]クラステンプレート std::boyer_moore_horspool_searcher
namespace std {template<class RandomAccessIter1, class Hash = hash<typename iterator_traits<RandomAccessIter1>::value_type>, class BinaryPredicate = equal_to<>>class boyer_moore_horspool_searcher {public: boyer_moore_horspool_searcher(RandomAccessIter1 pat_first, RandomAccessIter1 pat_last, Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); template<class RandomAccessIter2> pair<RandomAccessIter2, RandomAccessIter2> operator()(RandomAccessIter2 first, RandomAccessIter2 last)const; private: RandomAccessIter1 pat_first_;// exposition only RandomAccessIter1 pat_last_;// exposition only Hash hash_;// exposition only BinaryPredicate pred_;// exposition only};}
[編集]関連項目
<string> | std::string, std::u16string, std::u32string, std::wstring に対する std::hash の特殊化 |
<system_error> | std::error_code に対する std::hash の特殊化 |
<bitset> | std::bitset に対する std::hash の特殊化 |
<memory> | std::unique_ptr, std::shared_ptr に対する std::hash の特殊化 |
<typeindex> | std::type_index に対する std::hash の特殊化 |
<vector> | std::vector<bool> に対する std::hash の特殊化 |
<thread> | std::thread::id に対する std::hash の特殊化 |