Skip to content
Snippets Groups Projects
Commit 30af2f7f authored by Oliver Sander's avatar Oliver Sander
Browse files

Use system implementation of 'array' if present. Deprecate constructor...

Use system implementation of 'array' if present.  Deprecate constructor array(const T& t) because the libstd++ implementation doesn't have it

[[Imported from SVN: r4933]]
parent 52f893ac
Branches
Tags
No related merge requests found
......@@ -3,17 +3,24 @@
#ifndef DUNE_FIXEDARRAY_HH
#define DUNE_FIXEDARRAY_HH
//***********************************************************************
//
// implementation of peter array
//
//***********************************************************************
/** \file
\brief implementation of the stl array class (a static array)
and its deprecated ancestor FixedArray
*/
#include <iostream>
#include <iomanip>
#include <string>
// Include system implementation of array class if present
#ifdef HAVE_ARRAY
#include <array>
#endif
#ifdef HAVE_TR1_ARRAY
#include <tr1/array>
#endif
namespace Dune
{
/** @addtogroup Common
......@@ -21,6 +28,12 @@ namespace Dune
@{
*/
#ifdef HAVE_ARRAY
using std::array;
#elif defined HAVE_TR1_ARRAY
using std::tr1::array;
#else
/** \brief Simple fixed size array class
*
*/
......@@ -58,8 +71,10 @@ namespace Dune
//! Create uninitialized array
array () {}
//! Initialize all components with same size
array (const T& t)
/** \brief Initialize all components with same entry
\deprecated Deprecated because the stl implementation of array doesn't have it
*/
array (const T& t) DUNE_DEPRECATED
{
for (int i=0; i<N; i++) a[i]=t;
}
......@@ -89,7 +104,7 @@ namespace Dune
protected:
T a[(N > 0) ? N : 1];
};
#endif
//! Output operator for array
template <class T, int N>
inline std::ostream& operator<< (std::ostream& s, array<T,N> e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment