IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
IMP::Array< D, Data, SwigData > Class Template Reference

A class to store a fixed array of same-typed values. More...

#include <IMP/Array.h>

+ Inheritance diagram for IMP::Array< D, Data, SwigData >:

Detailed Description

template<unsigned int D, class Data, class SwigData = Data>
class IMP::Array< D, Data, SwigData >

A class to store a fixed array of same-typed values.

Only the constructor with the correct number of arguments for the dimensionality can be used.

Elements can be accessed using [] notation or std::get. The latter is more efficient when the index is a constant, since the bounds check can be done at compile time rather than runtime, e.g. x = std::get<0>(array) is more efficient than x = array[0].

Note
These are mapped to/from Python tuples, so there is no need to use types that are typedefs of this on the Python side.
See Also
ConstVector

Definition at line 40 of file Array.h.

Public Types

typedef Storage::const_iterator const_iterator
 
typedef Storage::iterator iterator
 

Public Member Functions

template<int DT = D, typename std::enable_if< DT==2 >::type * = nullptr>
 Array (SwigData x, SwigData y)
 
template<int DT = D, typename std::enable_if< DT==3 >::type * = nullptr>
 Array (SwigData x, SwigData y, SwigData z)
 
template<int DT = D, typename std::enable_if< DT==4 >::type * = nullptr>
 Array (SwigData x0, SwigData x1, SwigData x2, SwigData x3)
 
iterator begin ()
 
const_iterator begin () const
 
Data * data ()
 
const Data * data () const
 
iterator end ()
 
const_iterator end () const
 
SwigData get (unsigned int i) const
 
unsigned int get_dimension ()
 
std::string get_name () const
 
const Data operator[] (unsigned int i) const
 
Data & operator[] (unsigned int i)
 
void show (std::ostream &out=std::cout) const
 
unsigned int size () const
 

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