From: David Wells Date: Mon, 5 Oct 2015 15:18:05 +0000 (-0400) Subject: Wrap boost::enable_if_c as std_cxx11::enable_if. X-Git-Tag: v8.4.0-rc2~338^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4a9f78840dec8a53e2a245633979212d73b6b1a;p=dealii.git Wrap boost::enable_if_c as std_cxx11::enable_if. Note that boost::enable_if is not quite the same thing as std::enable_if from the C++11 standard library. This cleans up some of the memory consumption code. --- diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 58e9fcbb54..20dc2fed48 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -22,10 +22,6 @@ #include #include -// unfortunately, boost::enable_if_c, not boost::enable_if, is equivalent to -// std::enable_if -#include - #include #include #include @@ -100,7 +96,7 @@ namespace MemoryConsumption */ template inline - typename boost::enable_if_c::value, std::size_t>::type + typename std_cxx11::enable_if::value, std::size_t>::type memory_consumption (const T &t); /** @@ -111,7 +107,7 @@ namespace MemoryConsumption */ template inline - typename boost::enable_if_c::value || std_cxx11::is_pointer::value), std::size_t>::type + typename std_cxx11::enable_if::value || std_cxx11::is_pointer::value), std::size_t>::type memory_consumption (const T &t); /** @@ -248,7 +244,7 @@ namespace MemoryConsumption { template inline - typename boost::enable_if_c::value, std::size_t>::type + typename std_cxx11::enable_if::value, std::size_t>::type memory_consumption(const T &) { return sizeof(T); @@ -380,7 +376,7 @@ namespace MemoryConsumption template inline - typename boost::enable_if_c::value || std_cxx11::is_pointer::value), std::size_t>::type + typename std_cxx11::enable_if::value || std_cxx11::is_pointer::value), std::size_t>::type memory_consumption (const T &t) { return t.memory_consumption(); diff --git a/include/deal.II/base/std_cxx11/type_traits.h b/include/deal.II/base/std_cxx11/type_traits.h index 114485d1e9..261f67392e 100644 --- a/include/deal.II/base/std_cxx11/type_traits.h +++ b/include/deal.II/base/std_cxx11/type_traits.h @@ -32,12 +32,14 @@ namespace std_cxx11 using std::is_pointer; using std::is_standard_layout; using std::is_trivial; + using std::enable_if; } DEAL_II_NAMESPACE_CLOSE #else #include +#include DEAL_II_NAMESPACE_OPEN namespace std_cxx11 { @@ -45,6 +47,11 @@ namespace std_cxx11 using boost::is_pod; using boost::is_pointer; + // boost::enable_if_c, *not* boost::enable_if, is equivalent to std::enable_if. + template + struct enable_if : public boost::enable_if_c + {}; + // boost does not have is_standard_layout and // is_trivial, but those are both a subset of // is_pod