Gromacs
2018.1
|
#include <gromacs/simd/simd_memory.h>
STL-like container for aligned SIMD type. Used as ArrayRef<SimdReal>.
Should provide the same interface as ArrayRef. Any missing functions should be added as needed. The pointer type (used e.g. for initialization) is a real pointer. The reference type (used e.g. for operator[] and iterator dereference) is SimdReference which executes the aligned load/store as is appropriate. For both iterator and element access, the access happens in blocks of SIMD width. Meaning that a[1] refers to the 2nd SIMD vector and thus reals 8-15 for 8-wide SIMD. The starting address has to be aligned and the length has to be multiple of the SIMD width.
T | SIMD type (e.g. SimdReal) |
Public Types | |
using | size_type = size_t |
Type for representing size of the container. | |
using | difference_type = std::ptrdiff_t |
Type for representing difference between two container indices. | |
using | value_type = T |
Type of values stored in the container. | |
using | pointer = typename SimdTraits< T >::type * |
Pointer to a container element. | |
using | reference = internal::SimdReference< T > |
Reference to a container element. | |
using | iterator = SimdIterator< T > |
Iterator type for the container. | |
using | reverse_iterator = std::reverse_iterator< iterator > |
Standard reverse iterator. | |
Public Member Functions | |
SimdArrayRef (pointer begin, pointer end) | |
Constructs a reference to a particular range. More... | |
SimdArrayRef (const EmptyArrayRef &) | |
Constructs an empty reference. More... | |
template<typename U , typename = typename std::enable_if< std::is_convertible<typename std::remove_reference<U>::type::pointer, pointer>::value>::type> | |
SimdArrayRef (U &&o) | |
size_type | size () const |
Returns the size of the container. | |
bool | empty () const |
Whether the container is empty. | |
iterator | begin () const |
Returns an iterator to the beginning of the container. | |
iterator | end () const |
Returns an iterator to the end of the container. | |
reference | operator[] (size_type n) |
Access container element. | |
reference | front () const |
Returns the first element in the container. | |
reference | back () const |
Returns the first element in the container. | |
Friends | |
template<typename U > | |
class | SimdArrayRef |
|
inline |
Constructs a reference to a particular range.
[in] | begin | Pointer to the beginning of a range. |
[in] | end | Pointer to the end of a range. |
Passed pointers must remain valid for the lifetime of this object.
|
inline |
Constructs an empty reference.
This is provided for convenience, such that EmptyArrayRef can be used to initialize any ArrayRef, without specifying the template type. It is not explicit to enable that usage.
|
inline |