インテル® 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: 同期後のホルダーの値を決定するためのポリシー。有効なキーワードは次のとおりです。

Allocator: 各ホルダーのビューの割り当てに使用されるメモリー・アロケーター。