From 7205583c96a213880ab17dfc7cecd3e84f8b9236 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Sat, 22 Mar 2014 11:29:26 +0100
Subject: [PATCH] [cleanup] Remove check/fallback code for std::shared_ptr,
 std::make_shared.

---
 cmake/modules/CheckSharedPtr.cmake |  84 ------
 cmake/modules/Makefile.am          |   1 -
 config.h.cmake                     |  15 -
 dune/common/shared_ptr.hh          | 443 +----------------------------
 dune/common/test/CMakeLists.txt    |   3 -
 dune/common/test/Makefile.am       |   5 -
 dune/common/test/shared_ptrtest.cc |   7 +-
 m4/CMakeLists.txt                  |   2 -
 m4/Makefile.am                     |   2 -
 m4/dune_common.m4                  |   2 -
 m4/make_shared.m4                  |  35 ---
 m4/shared_ptr.m4                   |  90 ------
 12 files changed, 5 insertions(+), 684 deletions(-)
 delete mode 100644 cmake/modules/CheckSharedPtr.cmake
 delete mode 100644 m4/make_shared.m4
 delete mode 100644 m4/shared_ptr.m4

diff --git a/cmake/modules/CheckSharedPtr.cmake b/cmake/modules/CheckSharedPtr.cmake
deleted file mode 100644
index 1a962c2f6..000000000
--- a/cmake/modules/CheckSharedPtr.cmake
+++ /dev/null
@@ -1,84 +0,0 @@
-# Module checks for shared_ptr support.
-#
-# Sets the following variables:
-#
-# HAVE_BOOST_MAKE_SHARED_HPP: True if boost/make_shared.hpp is found
-# SHARED_PTR_NAMESPACE: Namespace of shared_ptr (e.g. std)
-# SHARED_PTR_HEADER: The name of header file supplying shared_ptr
-#
-# check if make_shared works
-macro(check_make_shared)
-  include(CheckIncludeFileCXX)
-
-  if(SHARED_PTR_NAMESPACE EQUAL "boost")
-    check_include_file_cxx("boost/make_shared.hpp" HAVE_BOOST_MAKE_SHARED_HPP)
-  endif(SHARED_PTR_NAMESPACE EQUAL "boost")
-
-  check_include_file_cxx("boost/shared_ptr.hpp" HAVE_BOOST_SHARED_PTR_HPP)
-
-  check_cxx_source_compiles("
-    #if defined(HAVE_MEMORY)
-    # include <memory>
-    #endif
-    #if defined(HAVE_TR1_MEMORY)
-    # include <tr1/memory>
-    #endif
-    #if defined(HAVE_BOOST_SHARED_PTR_HPP) && defined(HAVE_BOOST_MAKE_SHARED_HPP)
-    # include <boost/shared_ptr.hpp>
-    # include <boost/make_shared.hpp>
-    #endif
-
-    int main(void)
-    {
-       ${SHARED_PTR_NAMESPACE}::make_shared<int>(3);
-       return 0;
-    }
-    " HAVE_MAKE_SHARED)
-endmacro(check_make_shared)
-
-# check location of shared_ptr header file and the necessary namespace
-include(CheckCXXSourceCompiles)
-
-# search namespace
-foreach(SHARED_PTR_NAMESPACE_ "std" "tr1" "std::tr1" "boost")
-  check_cxx_source_compiles("
-    #include <memory>
-    #include <string>
-
-    using ${SHARED_PTR_NAMESPACE_}::shared_ptr;
-    using namespace std;
-
-    int main(void)
-    {
-      shared_ptr<string> test_ptr(new string(\"test string\"));
-      return 0;
-    }"
-    SHARED_PTR_NAMESPACE_FOUND)
-
-  if(SHARED_PTR_NAMESPACE_FOUND)
-    #search header name
-    foreach(SHARED_PTR_HEADER_ "<memory>" "<tr1/memory>" "<boost/shared_ptr.hpp>")
-      check_cxx_source_compiles("
-        # include ${SHARED_PTR_HEADER_}
-        #include <string>
-
-        using ${SHARED_PTR_NAMESPACE_}::shared_ptr;
-        using namespace std;
-
-        int main(void)
-        {
-          shared_ptr<string> test_ptr(new string(\"test string\"));
-          return 0;
-        }"
-        SHARED_PTR_HEADER_FOUND)
-
-      if(SHARED_PTR_HEADER_FOUND)
-        # save result
-        set(SHARED_PTR_NAMESPACE ${SHARED_PTR_NAMESPACE_})
-        set(SHARED_PTR_HEADER ${SHARED_PTR_HEADER_})
-        check_make_shared()
-        return()
-      endif(SHARED_PTR_HEADER_FOUND)
-    endforeach(SHARED_PTR_HEADER_)
-  endif(SHARED_PTR_NAMESPACE_FOUND)
-endforeach(SHARED_PTR_NAMESPACE_)
diff --git a/cmake/modules/Makefile.am b/cmake/modules/Makefile.am
index 917612ce2..a78a1271e 100644
--- a/cmake/modules/Makefile.am
+++ b/cmake/modules/Makefile.am
@@ -4,7 +4,6 @@ MODULES = \
   AddParMETISFlags.cmake   \
   AddUMFPackFlags.cmake    \
   CheckCXX11Features.cmake \
-  CheckSharedPtr.cmake     \
   DuneBoost.cmake \
   DuneCMakePackageConfigHelpers.cmake \
   DuneCommonMacros.cmake  \
diff --git a/config.h.cmake b/config.h.cmake
index 72c05a310..e50712c5e 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -40,21 +40,12 @@
 /* Define to ENABLE_BOOST if the Boost library is available */
 #cmakedefine HAVE_DUNE_BOOST ENABLE_BOOST
 
-/* Define to 1 if you have <boost/make_shared.hpp>. */
-#cmakedefine HAVE_BOOST_MAKE_SHARED_HPP 1
-
-/* Define to 1 if you have the <boost/shared_ptr.hpp> header file. */
-#cmakedefine HAVE_BOOST_SHARED_PTR_HPP 1
-
 /* does the compiler support abi::__cxa_demangle */
 #cmakedefine HAVE_CXA_DEMANGLE 1
 
 /* Define if you have LAPACK library. */
 #cmakedefine HAVE_LAPACK 1
 
-/* Define to 1 if SHARED_PTR_NAMESPACE::make_shared is usable. */
-#cmakedefine HAVE_MAKE_SHARED 1
-
 /* Define to 1 if you have the <malloc.h> header file. */
 // Not used! #cmakedefine01 HAVE_MALLOC_H
 
@@ -133,12 +124,6 @@
 
 /* end private */
 
-/* The header in which SHARED_PTR can be found */
-#cmakedefine SHARED_PTR_HEADER ${SHARED_PTR_HEADER}
-
-/* The namespace in which SHARED_PTR can be found */
-#cmakedefine SHARED_PTR_NAMESPACE ${SHARED_PTR_NAMESPACE}
-
 /* Define to 1 if variadic templates are supported */
 #cmakedefine HAVE_VARIADIC_TEMPLATES 1
 
diff --git a/dune/common/shared_ptr.hh b/dune/common/shared_ptr.hh
index e5f6e5424..6db28a39c 100644
--- a/dune/common/shared_ptr.hh
+++ b/dune/common/shared_ptr.hh
@@ -5,14 +5,7 @@
 #ifndef DUNE_SHARED_PTR_HH
 #define DUNE_SHARED_PTR_HH
 
-#if defined SHARED_PTR_HEADER
-# include SHARED_PTR_HEADER
-#endif
-#if defined HAVE_BOOST_SHARED_PTR_HPP
-#if defined HAVE_BOOST_MAKE_SHARED_HPP
-# include <boost/make_shared.hpp>
-#endif
-#endif
+#include <memory>
 
 #include <dune/common/nullptr.hh>
 #include <dune/common/typetraits.hh>
@@ -24,437 +17,9 @@
  */
 namespace Dune
 {
-  // A shared_ptr implementation has been found if SHARED_PTR_NAMESPACE is set at all
-#ifdef SHARED_PTR_NAMESPACE
-  using SHARED_PTR_NAMESPACE :: shared_ptr;
-#else
-
-  /** @addtogroup Common
-   *
-   * @{
-   */
-
-  /** @brief The object we reference. */
-  class SharedCount
-  {
-    template<class T1>
-    friend class shared_ptr;
-  protected:
-    /** @brief The number of references. */
-    int count_;
-    /** @brief Constructor from existing Pointer. */
-    SharedCount() : count_(1) {}
-    /** @brief Copy constructor with type conversion. */
-    SharedCount(const SharedCount& rep)
-      : count_(rep.count_) {}
-
-    /** @brief Destructor, deletes element_type* rep_. */
-    virtual ~SharedCount() {};
-
-  };
-  /**
-   * @brief A reference counting smart pointer.
-   *
-   * It is designed such that it is usable within a std::vector.
-   * The contained object is destroyed only if there are no more
-   * references to it.
-   */
-  template<class T>
-  class shared_ptr
-  {
-    template<class T1> friend class shared_ptr;
-
-  public:
-    /**
-     * @brief The data type we are a pointer for.
-     *
-     * This has to have a parameterless constructor.
-     */
-    typedef T element_type;
-
-    /**
-     * @brief Constructs a new smart pointer and allocates the referenced Object.
-     */
-    inline shared_ptr();
-
-    inline shared_ptr(nullptr_t null);
-
-    /**
-     * @brief Constructs a new smart pointer from a preallocated Object.
-     *
-     * \param pointer Raw pointer to the shared data
-     *
-     * note: the object must be allocated on the heap and after handing the pointer to
-     * shared_ptr the ownership of the pointer is also handed to the shared_ptr.
-     */
-    template<class T1>
-    inline shared_ptr(T1 * pointer);
-
-
-    /**
-     * @brief Constructs a new smart pointer from a preallocated Object.
-     *
-     * \tparam Deleter This class must by copyconstructable, the copy constructor must not throw an exception
-     * and it must implement void operator() (T*) const
-     *
-     * \param pointer Raw pointer to the shared data
-     * \param deleter A copy of this deleter is stored
-     *
-     * note: the object must be allocated on the heap and after handing the pointer to
-     * shared_ptr the ownership of the pointer is also handed to the shared_ptr.
-     */
-    template<class T1, class Deleter>
-    inline shared_ptr(T1 * pointer, Deleter deleter);
-
-    /**
-     * @brief Copy constructor.
-     * @param pointer The object to copy.
-     */
-    template<class T1>
-    inline shared_ptr(const shared_ptr<T1>& pointer);
-
-    /**
-     * @brief Copy constructor.
-     * @param pointer The object to copy.
-     */
-    inline shared_ptr(const shared_ptr& pointer);
-
-    /**
-     * @brief Destructor.
-     */
-    inline ~shared_ptr();
-
-    /** \brief Assignment operator */
-    template<class T1>
-    inline shared_ptr& operator=(const shared_ptr<T1>& pointer);
-
-    /** \brief Assignment operator */
-    inline shared_ptr& operator=(const shared_ptr& pointer);
-
-    /** \brief Dereference as object */
-    inline element_type& operator*();
-
-    /** \brief Dereference as pointer */
-    inline element_type* operator->();
-
-    /** \brief Dereference as const object */
-    inline const element_type& operator*() const;
-
-    /** \brief Dereference as const pointer */
-    inline const element_type* operator->() const;
-
-    /** \brief Access to the raw pointer, if you really want it */
-    element_type* get() const {
-      return rep_;
-    }
-
-    /** \brief Checks if shared_ptr manages an object, i.e. whether get() != 0. */
-    operator bool() const {
-      return count_ != 0 && rep_ != 0;
-    }
-
-    /** \brief Swap content of this shared_ptr and another */
-    inline void swap(shared_ptr& other);
-
-    /** \brief Decrease the reference count by one and free the memory if the
-        reference count has reached 0
-     */
-    inline void reset();
-
-    /** \brief Detach shared pointer and set it anew for the given pointer */
-    template<class T1>
-    inline void reset(T1* pointer);
-
-    //** \brief Same as shared_ptr(pointer,deleter).swap(*this)
-    template<class T1, class Deleter>
-    inline void reset(T1* pointer, Deleter deleter);
-
-    /** \brief The number of shared_ptrs pointing to the object we point to */
-    int use_count() const;
-
-  private:
-    /** \brief Assignment operator */
-    template<class T1>
-    inline shared_ptr& assign(const shared_ptr<T1>& pointer);
-    /** @brief Adds call to deleter to SharedCount. */
-    template<class Deleter>
-    class SharedCountImpl :
-      public SharedCount
-    {
-      template<class T1>
-      friend class shared_ptr;
-      /** @brief Constructor from existing Pointer with custom deleter. */
-      SharedCountImpl(T* elem,const Deleter& deleter) :
-        SharedCount(),
-        deleter_(deleter),
-        rep_(elem)
-      {}
-      /** @brief Copy constructor with type conversion. */
-      SharedCountImpl(const SharedCountImpl& rep)
-        : SharedCount(rep), deleter_(rep.deleter_), rep_(rep.rep_) {}
-      /** @brief Destructor, deletes element_type* rep_ using deleter. */
-      ~SharedCountImpl()
-      { deleter_(rep_); }
-
-      // store a copy of the deleter
-      Deleter deleter_;
-      T* rep_;
-    };
-
-    /** \brief A default deleter that just calls delete */
-    struct DefaultDeleter
-    {
-      void operator() (element_type* p) const
-      { delete p; }
-    };
-
-
-    SharedCount *count_;
-    T *rep_;
-
-    // Needed for the implicit conversion to "bool"
-    typedef T* *__unspecified_bool_type;
-
-  public:
-    /** \brief Implicit conversion to "bool" */
-    operator __unspecified_bool_type() const     // never throws
-    {
-      return rep_ == 0 ? 0 : &shared_ptr::rep_;
-    }
-
-  };
-
-  template<class T>
-  template<class T1>
-  inline shared_ptr<T>::shared_ptr(T1 * p)
-  {
-    rep_ = p;
-    count_ = new SharedCountImpl<DefaultDeleter>(p, DefaultDeleter());
-  }
-
-  template<class T>
-  inline shared_ptr<T>::shared_ptr(nullptr_t)
-  {
-    rep_   = 0;
-    count_ = 0;
-  }
-
-  template<class T>
-  template<class T1, class Deleter>
-  inline shared_ptr<T>::shared_ptr(T1 * p, Deleter deleter)
-  {
-    rep_ = p;
-    count_ = new SharedCountImpl<Deleter>(p, deleter);
-  }
-
-  template<class T>
-  inline shared_ptr<T>::shared_ptr()
-  {
-    rep_ = 0;
-    count_=0;
-  }
-
-  template<class T>
-  template<class T1>
-  inline shared_ptr<T>::shared_ptr(const shared_ptr<T1>& other)
-    : count_(other.count_), rep_(other.rep_)
-  {
-    if (rep_)
-      ++(count_->count_);
-  }
-
-  template<class T>
-  inline shared_ptr<T>::shared_ptr(const shared_ptr& other)
-    : count_(other.count_), rep_(other.rep_)
-  {
-    if (rep_)
-      ++(count_->count_);
-  }
-
-  template<class T>
-  template<class T1>
-  inline shared_ptr<T>& shared_ptr<T>::operator=(const shared_ptr<T1>& other)
-  {
-    return assign(other);
-  }
-
-  template<class T>
-  inline shared_ptr<T>& shared_ptr<T>::operator=(const shared_ptr& other)
-  {
-    return assign(other);
-  }
-
-  template<class T>
-  template<class T1>
-  inline shared_ptr<T>& shared_ptr<T>::assign(const shared_ptr<T1>& other)
-  {
-    if (other.count_)
-      (other.count_->count_)++;
-
-    if(rep_!=0 && --(count_->count_)<=0) {
-      delete count_;
-    }
-
-    rep_ = other.rep_;
-    count_ = other.count_;
-    return *this;
-  }
-
-  template<class T>
-  inline shared_ptr<T>::~shared_ptr()
-  {
-    if(rep_!=0 && --(count_->count_)==0) {
-      delete count_;
-      rep_=0;
-    }
-  }
-
-  template<class T>
-  inline T& shared_ptr<T>::operator*()
-  {
-    return *(rep_);
-  }
-
-  template<class T>
-  inline T *shared_ptr<T>::operator->()
-  {
-    return rep_;
-  }
-
-  template<class T>
-  inline const T& shared_ptr<T>::operator*() const
-  {
-    return *(rep_);
-  }
-
-  template<class T>
-  inline const T *shared_ptr<T>::operator->() const
-  {
-    return rep_;
-  }
-
-  template<class T>
-  inline int shared_ptr<T>::use_count() const
-  {
-    return count_->count_;
-  }
-
-  template<class T>
-  inline void shared_ptr<T>::swap(shared_ptr<T>& other)
-  {
-    SharedCount* dummy = count_;
-    count_=other.count_;
-    other.count_ = dummy;
-    T* tdummy=rep_;
-    rep_ = other.rep_;
-    other.rep_ = tdummy;
-  }
-
-  template<class T>
-  inline void shared_ptr<T>::reset()
-  {
-    shared_ptr<T>().swap(*this);
-  }
-
-  template<class T>
-  template<class T1>
-  inline void shared_ptr<T>::reset(T1* pointer)
-  {
-    shared_ptr<T>(pointer).swap(*this);
-  }
-
-  template<class T>
-  template<class T1, class Deleter>
-  inline void shared_ptr<T>::reset(T1* pointer, Deleter deleter)
-  {
-    shared_ptr<T>(pointer, deleter).swap(*this);
-  }
-
-  /** @} */
-#endif  // #ifdef SHARED_PTR_NAMESPACE
-
-
-  // C++0x and Boost have a make_shared implementation, TR1 does not.
-  // Unfortunately, TR1 gets picked over Boost if present.
-  // Moreover, boost::make_shared() only exists for (remotely) recent versions of Boost.
-#if HAVE_MAKE_SHARED
-#ifdef SHARED_PTR_NAMESPACE
-  using SHARED_PTR_NAMESPACE :: make_shared;
-#endif
-#else
-
-  template<typename T>
-  shared_ptr<T> make_shared()
-  {
-    return shared_ptr<T>(new T());
-  }
-
-  template<typename T, typename Arg1>
-  shared_ptr<T> make_shared(const Arg1& arg1)
-  {
-    return shared_ptr<T>(new T(arg1));
-  }
-
-  template<typename T, typename Arg1, typename Arg2>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2)
-  {
-    return shared_ptr<T>(new T(arg1,arg2));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3,arg4));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4,
-      typename Arg5>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4,
-                            const Arg5& arg5)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3,arg4,arg5));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4,
-      typename Arg5, typename Arg6>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4,
-                            const Arg5& arg5, const Arg6& arg6)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3,arg4,arg5,arg6));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4,
-      typename Arg5, typename Arg6, typename Arg7>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4,
-                            const Arg5& arg5, const Arg6& arg6, const Arg7& arg7)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3,arg4,arg5,arg6,arg7));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4,
-      typename Arg5, typename Arg6, typename Arg7, typename Arg8>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4,
-                            const Arg5& arg5, const Arg6& arg6, const Arg7& arg7, const Arg8& arg8)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8));
-  }
-
-  template<typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4,
-      typename Arg5, typename Arg6, typename Arg7, typename Arg8, typename Arg9>
-  shared_ptr<T> make_shared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4,
-                            const Arg5& arg5, const Arg6& arg6, const Arg7& arg7, const Arg8& arg8,
-                            const Arg9& arg9)
-  {
-    return shared_ptr<T>(new T(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9));
-  }
-
-#endif // custom make_shared
+  // pull in default implementations
+  using std::shared_ptr;
+  using std::make_shared;
 
   /**
      @brief implements the Deleter concept of shared_ptr without deleting anything
diff --git a/dune/common/test/CMakeLists.txt b/dune/common/test/CMakeLists.txt
index 6fac67f7f..889c0a50b 100644
--- a/dune/common/test/CMakeLists.txt
+++ b/dune/common/test/CMakeLists.txt
@@ -27,7 +27,6 @@ set(TESTS
     parametertreetest
     poolallocatortest
     shared_ptrtest_config
-    shared_ptrtest_dune
     singletontest
     static_assert_test
     streamtest
@@ -154,8 +153,6 @@ target_link_libraries("pathtest" "dunecommon")
 
 add_executable("poolallocatortest" poolallocatortest.cc)
 add_executable("shared_ptrtest_config" shared_ptrtest.cc)
-add_executable("shared_ptrtest_dune" shared_ptrtest.cc)
-set_target_properties(shared_ptrtest_dune PROPERTIES COMPILE_FLAGS "-DDISABLE_CONFIGURED_SHARED_PTR")
 add_executable("singletontest" singletontest.cc)
 add_executable("sllisttest" EXCLUDE_FROM_ALL sllisttest.cc)
 add_executable("static_assert_test" EXCLUDE_FROM_ALL static_assert_test.cc)
diff --git a/dune/common/test/Makefile.am b/dune/common/test/Makefile.am
index a5218adc3..60b668ca8 100644
--- a/dune/common/test/Makefile.am
+++ b/dune/common/test/Makefile.am
@@ -29,7 +29,6 @@ TESTPROGS = \
     parametertreetest \
     poolallocatortest \
     shared_ptrtest_config \
-    shared_ptrtest_dune \
     singletontest \
     static_assert_test \
     streamtest \
@@ -187,10 +186,6 @@ poolallocatortest_SOURCES = poolallocatortest.cc
 
 shared_ptrtest_config_SOURCES = shared_ptrtest.cc
 
-shared_ptrtest_dune_SOURCES = shared_ptrtest.cc
-shared_ptrtest_dune_CPPFLAGS = $(AM_CPPFLAGS)   \
-    -DDISABLE_CONFIGURED_SHARED_PTR
-
 singletontest_SOURCES = singletontest.cc
 
 sllisttest_SOURCES = sllisttest.cc
diff --git a/dune/common/test/shared_ptrtest.cc b/dune/common/test/shared_ptrtest.cc
index d06edb7ea..5630487cb 100644
--- a/dune/common/test/shared_ptrtest.cc
+++ b/dune/common/test/shared_ptrtest.cc
@@ -12,11 +12,6 @@
 #include "config.h"
 #endif
 
-#if defined(DISABLE_CONFIGURED_SHARED_PTR) && defined(SHARED_PTR_NAMESPACE)
-#undef SHARED_PTR_NAMESPACE
-#undef HAVE_MAKE_SHARED
-#endif
-
 #include <dune/common/classname.hh>
 #include <dune/common/shared_ptr.hh>
 
@@ -157,7 +152,7 @@ int main(){
     assert(bar);
 
     // test constructor from nullptr
-#if defined(SHARED_PTR_HEADER) && !defined(HAVE_NULLPTR)
+#ifndef HAVE_NULLPTR
         #error Construction of shared_ptr from a nullptr will not work as compiler
         #error does not support the latter.
     shared_ptr<double> bar_null=shared_ptr<double>();
diff --git a/m4/CMakeLists.txt b/m4/CMakeLists.txt
index 799a41d03..ad4a1af46 100644
--- a/m4/CMakeLists.txt
+++ b/m4/CMakeLists.txt
@@ -37,12 +37,10 @@ install(PROGRAMS
         immdx_lib_metis.m4
         inkscape.m4
         libtoolcompat.m4
-        make_shared.m4
         mprotect.m4
         mpi-config.m4
         opengl.m4
         parmetis.m4
-        shared_ptr.m4
         umfpack.m4
         xdr.m4
         DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dune/aclocal
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 0dd09cb90..e297c5179 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -40,12 +40,10 @@ ALLM4S = 					\
 	immdx_lib_metis.m4			\
 	inkscape.m4				\
 	libtoolcompat.m4			\
-	make_shared.m4				\
 	mpi-config.m4				\
 	mprotect.m4				\
 	opengl.m4				\
 	parmetis.m4				\
-	shared_ptr.m4				\
         umfpack.m4                              \
 	xdr.m4
 
diff --git a/m4/dune_common.m4 b/m4/dune_common.m4
index afb6dcd06..e6e1b5332 100644
--- a/m4/dune_common.m4
+++ b/m4/dune_common.m4
@@ -20,12 +20,10 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
   AC_REQUIRE([DUNE_CHECK_COMPILER])
   AC_REQUIRE([GXX0X])
   AC_REQUIRE([NULLPTR_CHECK])
-  AC_REQUIRE([SHARED_PTR])
   AC_REQUIRE([VARIADIC_TEMPLATES_CHECK])
   AC_REQUIRE([RVALUE_REFERENCES_CHECK])
   AC_REQUIRE([CXX11_CONSTEXPR_CHECK])
   AC_REQUIRE([DUNE_BOOST_BASE])
-  AC_REQUIRE([MAKE_SHARED])
   AC_REQUIRE([DUNE_LINKCXX])
   AC_REQUIRE([DUNE_CHECKDEPRECATED])
   AC_REQUIRE([DUNE_CHECKFINAL])
diff --git a/m4/make_shared.m4 b/m4/make_shared.m4
deleted file mode 100644
index ad731341d..000000000
--- a/m4/make_shared.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-AC_DEFUN([MAKE_SHARED],[
-  AC_REQUIRE([SHARED_PTR])
-  AS_IF([test "$SHARED_PTR_NAMESPACE" = "boost"],[
-    AC_CHECK_HEADER([boost/make_shared.hpp],
-      [AC_DEFINE([HAVE_BOOST_MAKE_SHARED_HPP], [1],
-      [Define to 1 if you have <boost/make_shared.hpp>.])
-    ])
-  ])
-  AC_CACHE_CHECK([whether SHARED_PTR_NAMESPACE ($SHARED_PTR_NAMESPACE) provides make_shared], 
-    dune_cv_make_shared, [
-    AC_LANG_PUSH([C++])
-    AC_COMPILE_IFELSE(
-      [AC_LANG_PROGRAM([[
-#if defined(HAVE_MEMORY)
-# include <memory>
-#endif
-#if defined(HAVE_TR1_MEMORY)
-# include <tr1/memory>
-#endif
-#if defined(HAVE_BOOST_SHARED_PTR_HPP) && defined(HAVE_BOOST_MAKE_SHARED_HPP)
-# include <boost/shared_ptr.hpp>
-# include <boost/make_shared.hpp>
-#endif
-#include <string>
-            ]],[[
-$SHARED_PTR_NAMESPACE::make_shared<int>(3);
-            ]])],
-      dune_cv_make_shared=yes,
-      dune_cv_make_shared=no)
-    AC_LANG_POP
-  ])
-  AS_IF([test "$dune_cv_make_shared" = "yes"],[
-    AC_DEFINE([HAVE_MAKE_SHARED], [1],
-                        [Define to 1 if SHARED_PTR_NAMESPACE::make_shared is usable.])])
-])
diff --git a/m4/shared_ptr.m4 b/m4/shared_ptr.m4
deleted file mode 100644
index ab9c75cc9..000000000
--- a/m4/shared_ptr.m4
+++ /dev/null
@@ -1,90 +0,0 @@
-dnl  Copyright (C) 2009 Sun Microsystems
-dnl This file is free software; Sun Microsystems
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl We check two things: where is the memory include file, and in what
-dnl namespace does shared_ptr reside.
-dnl We include AC_COMPILE_IFELSE for all the combinations we've seen in the
-dnl wild:
-dnl 
-dnl  GCC 4.3: namespace: std::  #include <memory>
-dnl  GCC 4.2: namespace: tr1::  #include <tr1/memory>
-dnl  GCC 4.2: namespace: boost::  #include <boost/shared_ptr.hpp>
-dnl
-dnl We define one of HAVE_HAVE_TR1_SHARED_PTR or HAVE_BOOST_SHARED_PTR
-dnl depending on location, SHARED_PTR_HEADER to be the header with enclosing
-dnl brackety braces in which shared_ptr is defined and SHARED_PTR_NAMESPACE to 
-dnl be the namespace in
-dnl which shared_ptr is defined.
-dnl 
-
-AC_DEFUN([SHARED_PTR],[
-dnl  AC_REQUIRE([PANDORA_CHECK_CXX_STANDARD])
-  AC_REQUIRE([DUNE_TR1_HEADERS])
-  AC_LANG_PUSH(C++)
-  AS_IF([test "x$enable_tr1_headers" != "xno"],
-    [AC_CHECK_HEADERS([memory tr1/memory])])
-  AC_CHECK_HEADERS([boost/shared_ptr.hpp])
-  AC_CACHE_CHECK([the location of shared_ptr header file],
-    [ac_cv_shared_ptr_h],[
-      for namespace in std tr1 std::tr1 boost
-      do
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[
-#include <string>
-
-using $namespace::shared_ptr;
-using namespace std;
-            ]],[[
-shared_ptr<string> test_ptr(new string("test string"));
-            ]])],
-            [
-              ac_cv_shared_ptr_namespace="${namespace}"
-              ac_cv_shared_ptr_header=missing
-              break
-            ],[
-	      ac_cv_shared_ptr_namespace=missing
-              ac_cv_shared_ptr_header=missing
-            ])
-        for header in memory tr1/memory boost/shared_ptr.hpp; do
-          AC_COMPILE_IFELSE(
-            [AC_LANG_PROGRAM([[
-# include <$header>
-#include <string>
-
-using $namespace::shared_ptr;
-using namespace std;
-              ]],[[
-shared_ptr<string> test_ptr(new string("test string"));
-              ]])],
-              [
-                ac_cv_shared_ptr_namespace="${namespace}"
-                ac_cv_shared_ptr_header="<${header}>"
-                break
-              ],[
-                ac_cv_shared_ptr_namespace=missing
-                ac_cv_shared_ptr_header=missing
-              ])
-         done
-         if test "$ac_cv_shared_ptr_namespace" != "missing"; then break; fi
-       done
-  ])
-  AS_IF([ test "x$ac_cv_shared_ptr_namespace" = xmissing ],
-    [], [
-      SHARED_PTR_NAMESPACE=${ac_cv_shared_ptr_namespace}
-      AC_DEFINE_UNQUOTED([SHARED_PTR_NAMESPACE],
-                         ${ac_cv_shared_ptr_namespace},
-                         [The namespace in which SHARED_PTR can be found])
-    ]
-  )
-  AS_IF([ test "x$ac_cv_shared_ptr_header" = xmissing ],
-    [], [
-      SHARED_PTR_HEADER=${ac_cv_shared_ptr_header}
-      AC_DEFINE_UNQUOTED([SHARED_PTR_HEADER],
-                         ${ac_cv_shared_ptr_header},
-                         [The header in which SHARED_PTR can be found])
-    ]
-  )
-  AC_LANG_POP()
-])
-- 
GitLab