template <int dimensions = 1, bool with_offset = true>
class item;

Similar to an sycl::id, the item describes the location of a point in a range. It can be used as an argument to a kernel function in a parallel_for to identify the work item. The item carries more information than than sycl::id, such as the range of an index space. The interface does not include a constructor because only the SYCL runtime needs to construct an item.

Template parameters


Number of dimensions in index space


True if item has offset

See also

SYCL Specification Section


sycl::id<dimensions> get_id() const;
size_t get_id(int dimension) const;

Returns sycl::id associated with item.


sycl::range<dimensions> get_range() const;
size_t get_range(int dimension) const;

Returns sycl::range associated with item.


*Only available when:
 with_offset is true*

sycl::id<dimensions> get_offset() const;

Returns offset associated with item.


size_t get_linear_id() const;

Returns the linear id, suitable for mapping the id to a 1 dimensional array.


size_t operator[](int dimension) const;

Returns id for dimension dimension.


operator sycl::item<dimensions, true>() const;

Returns item with offset set to 0.

Only available when with_offset is False.