標準ライブラリヘッダ <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++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 を実装する関数オブジェクト (クラステンプレート) | |
論理演算 | |
| 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 { // 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...)>&); }
[編集] 関連項目
| <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 の特殊化 |

