diff --git a/cmake/modules/CheckCXX11Features.cmake b/cmake/modules/CheckCXX11Features.cmake index d28e6af51ce63e525bd6a0862035da43c264cf97..c44feeeb38a8093b44b06af7a439a84db2469a2c 100644 --- a/cmake/modules/CheckCXX11Features.cmake +++ b/cmake/modules/CheckCXX11Features.cmake @@ -4,7 +4,6 @@ # Sets the follwing variables: # # HAVE_NULLPTR True if nullptr is available -# HAVE_ARRAY True if header <array> and fill() are available # HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported # HAS_ATTRIBUTE_UNUSED True if attribute unused is supported # HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported @@ -66,19 +65,6 @@ include(CheckIncludeFile) include(CheckIncludeFileCXX) if(NOT DISABLE_TR1_HEADERS) -# array and fill -check_cxx_source_compiles(" - #include <array> - - int main(void) - { - std::array<int,2> a; - a.fill(9); - return 0; - } -" HAVE_ARRAY -) - # Search for some tr1 headers foreach(_HEADER tuple tr1/tuple type_traits tr1/type_traits) string(REPLACE "/" "_" _HEADER_VAR ${_HEADER}) diff --git a/config.h.cmake b/config.h.cmake index a209c3e0fb6e1ae8f559243517a7df37765a910a..72c05a31016e17ac3410712629b0f47c4f8db116 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -34,9 +34,6 @@ /* does the compiler support __attribute__((unused))? */ #cmakedefine HAS_ATTRIBUTE_UNUSED 1 -/* Define to 1 if the header <array> from C++11 is available and supports array::fill */ -#cmakedefine HAVE_ARRAY 1 - /* Define if you have a BLAS library. */ #cmakedefine HAVE_BLAS 1 diff --git a/doc/buildsystem/buildsystem.tex b/doc/buildsystem/buildsystem.tex index 599aae9817dc384438a7e2da8870f696e459e00c..66d606f71cd3be88e94da63d97fde5fe4e205609 100644 --- a/doc/buildsystem/buildsystem.tex +++ b/doc/buildsystem/buildsystem.tex @@ -1100,12 +1100,13 @@ available and which dimension has been selected (if applicable). This information can then be used at compile-time to include header files or code that depend on optional packages. -As an example, the macro \lstinline!HAVE_ARRAY!\ can be used to compile -code using C++11 arrays as in +As an example, the macro \lstinline!HAVE_GMP!\ can be used to compile +code using the GNU Multiple Precision Arithmetic Library (GMP) as in \begin{lstlisting}[basicstyle=\ttfamily\scriptsize] -#ifdef HAVE_ARRAY -#include <array> -std::array <int, 5> a = {1, 2, 3}; +#ifdef HAVE_GMP +#include <gmp.h> +mpz_t d; +mpz_init_set_str(d, "14159265", 10); #endif \end{lstlisting} diff --git a/dune/common/array.hh b/dune/common/array.hh index 42e6ed1edf07a689db634af8f1bd47c6ea27058a..05a251d9f7170207a4cae7c8faaa50fe131b78b7 100644 --- a/dune/common/array.hh +++ b/dune/common/array.hh @@ -8,18 +8,8 @@ \brief Fallback implementation of the std::array class (a static array) */ -#include <iostream> -#include <iomanip> -#include <string> - // Include system implementation of array class if present -#ifdef HAVE_ARRAY #include <array> -#else -#include <algorithm> -#endif - -#include "deprecated.hh" namespace Dune { @@ -28,131 +18,8 @@ namespace Dune @{ */ -#ifdef HAVE_ARRAY + // pull in default implementation using std::array; -#else - - /** \brief Simple fixed size array class. This replaces std::array, - * if that is not available. - * - */ - template<class T, size_t N> - class array { - public: - - //! Remember the storage type - typedef T value_type; - - /** \brief Reference to an object */ - typedef value_type& reference; - - /** \brief Const reference to an object */ - typedef const value_type& const_reference; - - /** \brief Iterator type */ - typedef value_type* iterator; - - /** \brief Const iterator type */ - typedef const value_type* const_iterator; - - /** \brief Type used for array indices */ - typedef std::size_t size_type; - - /** \brief Difference type */ - typedef std::ptrdiff_t difference_type; - - /** \brief Reverse iterator type */ - typedef std::reverse_iterator<iterator> reverse_iterator; - - /** \brief Const reverse iterator type */ - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - - /** \brief Return array size */ - size_type size() const {return N;} - - //! Assign value to all entries - array<T,N>& operator= (const T& t) - { - fill(t); - return (*this); - } - - //! \brief Assign value to all entries (according to C++0x the fill method is to be prefered) - void assign(const T& t) DUNE_DEPRECATED - { - fill(t); - } - - //! \brief Assign value to all entries (according to C++0x the fill method is to be prefered) - void fill(const T& t) - { - for (size_type i=0; i<N; i++) a[i]=t; - } - - //! Component access - reference operator[] (size_type i) - { - return a[i]; - } - - //! Const component access - const_reference operator[] (size_type i) const - { - return a[i]; - } - - iterator begin () - { - return a; - } - - const_iterator begin () const - { - return a; - } - - iterator end () - { - return a + N; - } - - const_iterator end () const - { - return a + N; - } - - T a[(N > 0) ? N : 1]; - }; - - - - // Comparison Operators (see [lib.container.requirements]) - // ------------------------------------------------------- - - template< class T, size_t N > - inline bool operator< ( const array< T, N > &a, const array< T, N > &b ) - { - return std::lexicographical_compare( a.begin(), a.end(), b.begin(), b.end() ); - } - - template< class T, size_t N > - inline bool operator> ( const array< T, N > &a, const array< T, N > &b ) - { - return b < a; - } - - template< class T, size_t N > - inline bool operator<= ( const array< T, N > &a, const array< T, N > &b ) - { - return !(a > b); - } - - template< class T, size_t N > - inline bool operator>= ( const array< T, N > &a, const array< T, N > &b ) - { - return !(a < b); - } -#endif //! Output operator for array template < class T, size_t N > diff --git a/m4/dune_tr1_headers.m4 b/m4/dune_tr1_headers.m4 index a1c041b4665280a3e293fac302a20dbd98b57d87..11dfeed90f5ebd8591ad050c0f1eb950502c45ea 100644 --- a/m4/dune_tr1_headers.m4 +++ b/m4/dune_tr1_headers.m4 @@ -10,16 +10,6 @@ AC_DEFUN([DUNE_TR1_HEADERS], [ [enable_tr1_headers=yes]) AS_IF([test "x$enable_tr1_headers" != "xno"], [AC_CHECK_HEADERS([type_traits tr1/type_traits tuple tr1/tuple]) - AC_CACHE_CHECK([whether <array> C++0x is supported], dune_cv_array_cplusplus0x, [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include <array>]], - [[std::array<int,2> a; a.fill(9);]])], - dune_cv_array_cplusplus0x=yes, - dune_cv_array_cplusplus0x=no) - ]) - AS_IF([test "x$dune_cv_array_cplusplus0x" != "xno"], - [AC_DEFINE([HAVE_ARRAY], 1, [Define to 1 if the header <array> from C++0x is available and supports array::fill]) - ]) AC_CACHE_CHECK([whether integral_constant conforming to C++11 is supported], dune_cv_integral_constant_cplusplus11, [ AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([