Name

Range Concept — Requirements for a type representing a recursively divisible set of values. Table 3-2 lists the requirements for a Range type R.

Description

Table 3-2. Range Concept

Pseudosignature

Semantics

R::R( const R& )

Copy constructor

R::~R()

Destructor

bool R::empty() const

True if range is empty

bool R::is_divisible() const

True if range can be partitioned into two subranges

R::R( R& r, split )

Split r into two subranges

Description

A Range can be recursively subdivided into two parts. It is recommended that the division be into nearly equal parts, but it is not required. Splitting as evenly as possible typically yields the best parallelism. Ideally, a range is recursively splittable until the parts represent portions of work that are more efficient to execute serially rather than split further. This key limit to splitting is called the grain size. The amount of work represented by a Range typically depends upon higher-level context; hence, a typical type that models a Range should provide a way to control the degree of splitting. For example, the template class blocked_ range has a grainsize parameter that specifies the biggest range considered indivisible.

The constructor that implements splitting is called a splitting constructor. If the set of values has a sense of direction, by convention the splitting constructor should construct the second part of the range and update the argument to refer to the first part of the range. Following this convention ...

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.