STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types
stapl::single_container< T > Struct Template Reference

Generator container that returns the same element for every access. More...

Public Member Functions

 single_container (T const &x, size_t size=std::numeric_limits< size_t >::max())
 Create the container by initializing the single element and providing a size. More...
 
value_type get_element (size_t const &i) const
 Retrieve a copy of the element at a specific index. In actuality, returns the same element for every invocation. More...
 
value_type operator[] (size_t const &i) const
 Retrieve a copy of the element at a specific index. In actuality, returns the same element for every invocation. More...
 
size_t size () const
 Return the size of this container.
 
domain_type domain () const
 Create a linear domain of the GIDs in this container.
 

Public Types

typedef T value_type
 
typedef value_type mapped_type
 
typedef value_type reference
 
typedef indexed_domain< size_t > domain_type
 
typedef size_t gid_type
 

Detailed Description

template<typename T>
struct stapl::single_container< T >

Generator container that returns the same element for every access.

If there is a single_container c, there exists some element x such that c[i] == x for all i.

Template Parameters
TType of the stored element in the container.

Constructor & Destructor Documentation

◆ single_container()

template<typename T >
stapl::single_container< T >::single_container ( T const &  x,
size_t  size = std::numeric_limits<size_t>::max() 
)

Create the container by initializing the single element and providing a size.

Parameters
xThe element that is to be stored in this container.
sizeSize of this container

Member Function Documentation

◆ get_element()

template<typename T >
value_type stapl::single_container< T >::get_element ( size_t const &  i) const

Retrieve a copy of the element at a specific index. In actuality, returns the same element for every invocation.

Parameters
iThe index of the element to retrieve (unused)
Returns
Copy of the stored element.

◆ operator[]()

template<typename T >
value_type stapl::single_container< T >::operator[] ( size_t const &  i) const

Retrieve a copy of the element at a specific index. In actuality, returns the same element for every invocation.

Parameters
iThe index of the element to retrieve (unused)
Returns
Copy of the stored element.

The documentation for this struct was generated from the following file: