Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
Gecode::SharedArray< T > Class Template Reference

Shared array with arbitrary number of elements. More...

#include <shared-array.hpp>

Classes

class  SAO
 Implementation of object for shared arrays. More...

(Note that these are not member symbols.)

template<class Char, class Traits, class T>
std::basic_ostream< Char, Traits > & operator<< (std::basic_ostream< Char, Traits > &os, const SharedArray< T > &x)
 Print array elements enclosed in curly brackets.

Associated types

typedef T value_type
 Type of the view stored in this array.
typedef T & reference
 Type of a reference to the value type.
typedef const T & const_reference
 Type of a constant reference to the value type.
typedef T * pointer
 Type of a pointer to the value type.
typedef const T * const_pointer
 Type of a read-only pointer to the value type.
typedef T * iterator
 Type of the iterator used to iterate through this array's elements.
typedef const T * const_iterator
 Type of the iterator used to iterate read-only through this array's elements.
typedef std::reverse_iterator< T * > reverse_iterator
 Type of the iterator used to iterate backwards through this array's elements.
typedef std::reverse_iterator< const T * > const_reverse_iterator
 Type of the iterator used to iterate backwards and read-only through this array's elements.
 SharedArray (void)
 Construct as not yet intialized.
 SharedArray (int n)
 Initialize as array with n elements.
void init (int n)
 Initialize as array with n elements.
 SharedArray (const SharedArray &a)
 Initialize from shared array a (share elements)
 SharedArray (const ArgArrayBase< T > &a)
 Initialize from argument array a.
T & operator[] (int i)
 Access element at position i.
const T & operator[] (int i) const
 Access element at position i.
int size (void) const
 Return number of elements.
bool operator== (const SharedArray< T > &sa) const
 Test equality with sa.

Array iteration

iterator begin (void)
 Return an iterator at the beginning of the array.
const_iterator begin (void) const
 Return a read-only iterator at the beginning of the array.
iterator end (void)
 Return an iterator past the end of the array.
const_iterator end (void) const
 Return a read-only iterator past the end of the array.
reverse_iterator rbegin (void)
 Return a reverse iterator at the end of the array.
const_reverse_iterator rbegin (void) const
 Return a reverse and read-only iterator at the end of the array.
reverse_iterator rend (void)
 Return a reverse iterator past the beginning of the array.
const_reverse_iterator rend (void) const
 Return a reverse and read-only iterator past the beginning of the array.
SharedArrayoperator= (const SharedArray &)=default
 Assignment operator.

Additional Inherited Members

Public Member Functions inherited from Gecode::SharedHandle
 SharedHandle (void)
 Create shared handle with no object pointing to.
 SharedHandle (SharedHandle::Object *so)
 Create shared handle that points to shared object so.
 SharedHandle (const SharedHandle &sh)
 Copy constructor maintaining reference count.
SharedHandleoperator= (const SharedHandle &sh)
 Assignment operator maintaining reference count.
 ~SharedHandle (void)
 Destructor that maintains reference count.
 operator bool (void) const
 Whether handle points to an object.
Protected Member Functions inherited from Gecode::SharedHandle
SharedHandle::Objectobject (void) const
 Access to the shared object.
void object (SharedHandle::Object *n)
 Modify shared object.

Detailed Description

template<class T>
class Gecode::SharedArray< T >

Shared array with arbitrary number of elements.

Sharing is implemented by reference counting: the same elements are shared among several objects.

Definition at line 53 of file shared-array.hpp.

Member Typedef Documentation

◆ value_type

template<class T>
typedef T Gecode::SharedArray< T >::value_type

Type of the view stored in this array.

Definition at line 89 of file shared-array.hpp.

◆ reference

template<class T>
typedef T& Gecode::SharedArray< T >::reference

Type of a reference to the value type.

Definition at line 91 of file shared-array.hpp.

◆ const_reference

template<class T>
typedef const T& Gecode::SharedArray< T >::const_reference

Type of a constant reference to the value type.

Definition at line 93 of file shared-array.hpp.

◆ pointer

template<class T>
typedef T* Gecode::SharedArray< T >::pointer

Type of a pointer to the value type.

Definition at line 95 of file shared-array.hpp.

◆ const_pointer

template<class T>
typedef const T* Gecode::SharedArray< T >::const_pointer

Type of a read-only pointer to the value type.

Definition at line 97 of file shared-array.hpp.

◆ iterator

template<class T>
typedef T* Gecode::SharedArray< T >::iterator

Type of the iterator used to iterate through this array's elements.

Definition at line 99 of file shared-array.hpp.

◆ const_iterator

template<class T>
typedef const T* Gecode::SharedArray< T >::const_iterator

Type of the iterator used to iterate read-only through this array's elements.

Definition at line 101 of file shared-array.hpp.

◆ reverse_iterator

template<class T>
typedef std::reverse_iterator<T*> Gecode::SharedArray< T >::reverse_iterator

Type of the iterator used to iterate backwards through this array's elements.

Definition at line 103 of file shared-array.hpp.

◆ const_reverse_iterator

template<class T>
typedef std::reverse_iterator<const T*> Gecode::SharedArray< T >::const_reverse_iterator

Type of the iterator used to iterate backwards and read-only through this array's elements.

Definition at line 105 of file shared-array.hpp.

Constructor & Destructor Documentation

◆ SharedArray() [1/4]

template<class T>
Gecode::SharedArray< T >::SharedArray ( void )
inline

Construct as not yet intialized.

The only member functions that can be used on a constructed but not yet initialized shared array is init and the assignment operator .

Definition at line 245 of file shared-array.hpp.

◆ SharedArray() [2/4]

template<class T>
Gecode::SharedArray< T >::SharedArray ( int n)
inline

Initialize as array with n elements.

Definition at line 249 of file shared-array.hpp.

◆ SharedArray() [3/4]

template<class T>
Gecode::SharedArray< T >::SharedArray ( const SharedArray< T > & a)
inline

Initialize from shared array a (share elements)

Definition at line 254 of file shared-array.hpp.

◆ SharedArray() [4/4]

template<class T>
Gecode::SharedArray< T >::SharedArray ( const ArgArrayBase< T > & a)
inline

Initialize from argument array a.

Definition at line 294 of file shared-array.hpp.

Member Function Documentation

◆ init()

template<class T>
void Gecode::SharedArray< T >::init ( int n)
inline

Initialize as array with n elements.

This member function can only be used once and only if the shared array has been constructed with the default constructor.

Definition at line 259 of file shared-array.hpp.

◆ operator[]() [1/2]

template<class T>
T & Gecode::SharedArray< T >::operator[] ( int i)
inline

Access element at position i.

Definition at line 266 of file shared-array.hpp.

◆ operator[]() [2/2]

template<class T>
const T & Gecode::SharedArray< T >::operator[] ( int i) const
inline

Access element at position i.

Definition at line 273 of file shared-array.hpp.

◆ size()

template<class T>
int Gecode::SharedArray< T >::size ( void ) const
inline

Return number of elements.

Definition at line 302 of file shared-array.hpp.

◆ operator==()

template<class T>
bool Gecode::SharedArray< T >::operator== ( const SharedArray< T > & sa) const
inline

Test equality with sa.

Definition at line 280 of file shared-array.hpp.

◆ begin() [1/2]

template<class T>
SharedArray< T >::iterator Gecode::SharedArray< T >::begin ( void )
inline

Return an iterator at the beginning of the array.

Definition at line 309 of file shared-array.hpp.

◆ begin() [2/2]

template<class T>
SharedArray< T >::const_iterator Gecode::SharedArray< T >::begin ( void ) const
inline

Return a read-only iterator at the beginning of the array.

Definition at line 316 of file shared-array.hpp.

◆ end() [1/2]

template<class T>
SharedArray< T >::iterator Gecode::SharedArray< T >::end ( void )
inline

Return an iterator past the end of the array.

Definition at line 323 of file shared-array.hpp.

◆ end() [2/2]

template<class T>
SharedArray< T >::const_iterator Gecode::SharedArray< T >::end ( void ) const
inline

Return a read-only iterator past the end of the array.

Definition at line 330 of file shared-array.hpp.

◆ rbegin() [1/2]

template<class T>
SharedArray< T >::reverse_iterator Gecode::SharedArray< T >::rbegin ( void )
inline

Return a reverse iterator at the end of the array.

Definition at line 337 of file shared-array.hpp.

◆ rbegin() [2/2]

template<class T>
SharedArray< T >::const_reverse_iterator Gecode::SharedArray< T >::rbegin ( void ) const
inline

Return a reverse and read-only iterator at the end of the array.

Definition at line 344 of file shared-array.hpp.

◆ rend() [1/2]

template<class T>
SharedArray< T >::reverse_iterator Gecode::SharedArray< T >::rend ( void )
inline

Return a reverse iterator past the beginning of the array.

Definition at line 351 of file shared-array.hpp.

◆ rend() [2/2]

template<class T>
SharedArray< T >::const_reverse_iterator Gecode::SharedArray< T >::rend ( void ) const
inline

Return a reverse and read-only iterator past the beginning of the array.

Definition at line 358 of file shared-array.hpp.

◆ operator=()

template<class T>
SharedArray & Gecode::SharedArray< T >::operator= ( const SharedArray< T > & )
default

Assignment operator.

◆ operator<<()

template<class Char, class Traits, class T>
std::basic_ostream< Char, Traits > & operator<< ( std::basic_ostream< Char, Traits > & os,
const SharedArray< T > & x )
related

Print array elements enclosed in curly brackets.

Definition at line 358 of file shared-array.hpp.


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