Empirical
Classes | Namespaces | Functions
array.h File Reference

A drop-in wrapper for std::array; adds on bounds checking in debug mode. More...

#include <initializer_list>
#include <array>
#include "assert.h"
#include "../meta/TypeID.h"

Go to the source code of this file.

Classes

class  emp::array< T, N >
 
struct  emp::array< T, N >::iterator_wrapper< ITERATOR_T >
 Setup an iterator wrapper to make sure that they're valid. More...
 
struct  emp::TypeID< emp::array< T, N > >
 Ensure that emp::array works with TypeID. More...
 

Namespaces

 emp
 If we are in emscripten, make sure to include the header.
 

Functions

template<typename T , size_t N>
std::ostream & operator<< (std::ostream &out, const emp::array< T, N > &v)
 
template<typename T , size_t N>
std::istream & operator>> (std::istream &is, emp::array< T, N > &v)
 

Detailed Description

A drop-in wrapper for std::array; adds on bounds checking in debug mode.

Note
This file is part of Empirical, https://github.com/devosoft/Empirical
Date
2016-2018
Note
Status: RELEASE

If EMP_NDEBUG is set, emp::array is just an alias for std::array. Otherwise, every time an array is accessed, tests are done to make sure that the access is legal.

Todo:

Add tests in array::front and array::back to ensure not empty.

Add tests for get.

Function Documentation

template<typename T , size_t N>
std::ostream& operator<< ( std::ostream &  out,
const emp::array< T, N > &  v 
)
template<typename T , size_t N>
std::istream& operator>> ( std::istream &  is,
emp::array< T, N > &  v 
)