インテル® C++ コンパイラー 17.0 デベロッパー・ガイドおよびリファレンス
ホルダーの構文は、次のとおりです。
#include <cilk/holder.h>
enum holder_policy {
holder_keep_indeterminate,
holder_keep_last,
holder_keep_last_copy,
holder_keep_last_swap,
holder_keep_last_move
};
template <typename Type,
holder_policy Policy = holder_keep_indeterminate,
typename Allocator = std::allocator<Type> >
class holder
{
/// Default constructor uses default-initialization for both the
/// leftmost view and each identity view.
holder(const Allocator& alloc = Allocator());
/// Construct from an exemplar that is used to initialize both the
/// leftmost view and each identity view.
holder(const Type& v, const Allocator& alloc = Allocator());
/// Construct from a functor that is used to initialize both the
/// leftmost view and each identity view. The functor, 'f', must be be
/// invokable using the expression 'Type x = f()'.
template <typename Func>
holder(const Func& f, const Allocator& alloc = Allocator());
/// Return the current view
Type& view();
Type const& view() const;
Type& operator()();
Type const& operator()() const;
};
テンプレート引数:
Type: ホルダーに格納するオブジェクトの型。
Policy: 同期後のホルダーの値を決定するためのポリシー。有効なキーワードは次のとおりです。
holder_keep_indeterminate:
ホルダーの値は、中間値になります (最も効率的)。holder_keep_last: ホルダーの値は、プログラムのシリアル部分で設定された最後の値になります。インテル® Cilk™ Plus ライブラリーは、最も効率的なものを選択するコンパイル時のヒューリスティックを使用して、次のいずれかのポリシーを選択します。
holder_keep_last_copy: ホルダーの値は、プログラムのシリアル部分で設定された最後の値をコピー割り当てしたものになります。
holder_keep_last_swap: ホルダーの値は、Type::swap(Type&) メンバー関数を呼び出して設定されます。
holder_keep_last_move: ホルダーの値は、プログラムのシリアル部分で設定された最後の値を移動割り当てしたものになります (C++11 モードの場合のみ)。
Allocator: 各ホルダーのビューの割り当てに使用されるメモリー・アロケーター。