Intel® Cilk™ Plus is a deprecated feature. Use OpenMP* or Intel® Threading Building Blocks instead. For more information see Migrate Your Application to use OpenMP* or Intel® TBB Instead of Intel® Cilk™ Plus.

Holder syntax is as follows:

#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;
};

Template Parameters:

Type: The type of object held in the holder

Policy: The policy for deciding the value of the holder after a sync. Valid keywords are the following:

  • holder_keep_indeterminate:

    The value of the holder is indeterminate (most efficient.)
  • holder_keep_last: The value of the holder is the last value that would have been set in the program serialization. The Intel® Cilk™ Plus library will choose one of the policies below using compile-time heuristics that attempt to pick the most efficient.

  • holder_keep_last_copy: The value of the holder is set by copy-assigning the last value that would have been set in the program serialization.

  • holder_keep_last_swap: The value of the holder is set by invoking the Type::swap(Type&) member function.

  • holder_keep_last_move: The value of the holder is set by move-assigning the last value that would have been set in the program serialization (C++11-mode only).

Allocator: A memory allocator used to allocate each holder view.

Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.