Grappa  r3821, hash 22cd626d567a91ead5b23302066d1e9469f45c66
Grappa::util Namespace Reference

Classes

struct  SimpleIterator
 

Functions

template<typename T >
std::string array_str (const char *name, GlobalAddress< T > base, size_t nelem, int width=10)
 String representation of a global array. More...
 
template<int width = 10, typename ArrayT = nullptr_t>
std::string array_str (const char *name, const ArrayT &array)
 
template<int width = 10, typename ArrayT = nullptr_t>
std::string array_str (const ArrayT &array)
 
template<typename T >
SimpleIterator< T > iterate (T *base=nullptr, size_t nelem=0)
 Easier C++11 iteration over local array. More...
 
template<int width = 10, typename T = nullptr_t>
std::string array_str (const char *name, T *base, size_t nelem)
 String representation of a local array, matches form of Grappa::array_str that takes a global array. More...
 

Function Documentation

template<typename T >
std::string Grappa::util::array_str ( const char *  name,
GlobalAddress< T >  base,
size_t  nelem,
int  width = 10 
)
inline

String representation of a global array.

DVLOG(2) << array_str("x", xs, 4);
// (if DEBUG=1 and --v=2)
//> x: [
//> 7 4 2 3
//> ]

Definition at line 186 of file Array.hpp.

template<int width = 10, typename ArrayT = nullptr_t>
std::string Grappa::util::array_str ( const char *  name,
const ArrayT &  array 
)
inline

Definition at line 197 of file Array.hpp.

template<int width = 10, typename ArrayT = nullptr_t>
std::string Grappa::util::array_str ( const ArrayT &  array)
inline

Definition at line 215 of file Array.hpp.

template<int width = 10, typename T = nullptr_t>
std::string Grappa::util::array_str ( const char *  name,
T *  base,
size_t  nelem 
)
inline

String representation of a local array, matches form of Grappa::array_str that takes a global array.

Definition at line 244 of file Array.hpp.

template<typename T >
SimpleIterator<T> Grappa::util::iterate ( T *  base = nullptr,
size_t  nelem = 0 
)

Easier C++11 iteration over local array.

Similar idea to Addressing::iterate_local().

auto array = new long[N];
for (auto& v : util::iterate(array,N)) {
v++;
}

Definition at line 240 of file Array.hpp.