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

the class FixedArray, which has been deprecated in 1.1, is now removed. Use std::array instead

[[Imported from SVN: r5132]]
parent c9ca4f04
Branches
Tags v2.4.0-rc1
No related merge requests found
......@@ -12,8 +12,6 @@
#include <iomanip>
#include <string>
#include <dune/common/deprecated.hh>
// Include system implementation of array class if present
#ifdef HAVE_ARRAY
#include <array>
......@@ -73,14 +71,6 @@ namespace Dune
//! Create uninitialized array
array () {}
/** \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;
}
/** \brief Return array size */
size_type size() const {return N;}
......@@ -123,95 +113,6 @@ namespace Dune
return s;
}
/** \brief Simple fixed size array class
* \deprecated Replaced by array
*/
template<class T, int N>
class FixedArray {
public:
//! Remember the storage type
typedef T MemberType;
//! The actual number of elements that gets allocated.
//! It's always at least 1.
enum { n = (N > 0) ? N : 1 };
//! Know your own length
enum { dimension = N };
//! Create uninitialized array
FixedArray () {}
//! Initialize all components with same size
FixedArray (T t) DUNE_DEPRECATED
{
for (int i=0; i<N; i++) a[i]=t;
}
/** \brief Return array size */
int size() const {return N;}
/** \brief Assign value to all entries
* @deprecated Use assign instead.
*/
FixedArray<T,N>& operator= (const T& t) DUNE_DEPRECATED
{
assign(t);
return (*this);
}
//! \brief Assign value to all entries
void assign(const T& t)
{
for (int i=0; i<N; i++) a[i]=t;
}
//! Component access
T& operator[] (int i)
{
return a[i];
}
//! Const component access
const T& operator[] (int i) const
{
return a[i];
}
//! \todo Please doc me!
FixedArray<T,N-1> shrink (int comp)
{
FixedArray<T,N-1> x;
for (int i=0; i<comp; i++) x[i] = a[i];
for (int i=comp+1; i<N; i++) x[i-1] = a[i];
return x;
}
//! \todo Please doc me!
FixedArray<T,N+1> expand (int comp, T value)
{
FixedArray<T,N+1> x;
for (int i=0; i<comp; i++) x[i] = a[i];
x[comp] = value;
for (int i=comp+1; i<N+1; i++) x[i] = a[i-1];
return x;
}
protected:
T a[n];
} DUNE_DEPRECATED;
//! Output operator for FixedArray
template <class T, int N>
inline std::ostream& operator<< (std::ostream& s, FixedArray<T,N> e)
{
s << "[";
for (int i=0; i<N-1; i++) s << e[i] << ",";
s << e[N-1] << "]";
return s;
}
/** @} */
} // end namespace Dune
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment