Skip to content
Snippets Groups Projects
Commit 7bb2bdbb authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[cleanup] Remove check and fallback code for std::conditional.

parent ba40259a
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,6 @@
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supprt
# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
# HAVE_STD_CONDITIONAL True if std::conditional is supported
# HAVE_CONSTEXPR True if constexpr is supported
# HAVE_KEYWORD_FINAL True if final is supported.
......@@ -282,16 +281,6 @@ check_cxx_source_compiles("
" HAVE_RVALUE_REFERENCES
)
# std::conditional
check_cxx_source_compiles("
#include <type_traits>
int main(void){
return std::conditional<true,std::integral_constant<int,0>,void>::type::value;
}
" HAVE_STD_CONDITIONAL
)
# constexpr
check_cxx_source_compiles("
constexpr int foo()
......
......@@ -105,9 +105,6 @@
/* Define to 1 if you have the <type_traits> header file. */
#cmakedefine HAVE_TYPE_TRAITS 1
/* Define to 1 if you have the <type_traits> header file. */
#cmakedefine HAVE_STD_CONDITIONAL 1
/* Define to 1 if the MPI2 Standard is supported */
#cmakedefine MPI_2 1
......
......@@ -373,44 +373,9 @@ namespace Dune
};
#endif
#if DOXYGEN || !HAVE_STD_CONDITIONAL
/**
* @brief Select a type based on a condition.
*
* If template parameter first is true T1 is selected
* otherwise T2 will be selected.
* The selected type is accessible through the typedef
* type.
*
* \note If available, this uses C++11 std::conditional, otherwise it provides
* a reimplementation.
*/
template<bool first, class T1, class T2>
struct conditional
{
/**
* @brief The selected type
*
* if first is true this will be type T1 and
* T2 otherwise
*/
typedef T1 type;
};
template<class T1, class T2>
struct conditional<false,T1,T2>
{
typedef T2 type;
};
#else // DOXYGEN || !HAVE_STD_CONDITIONAL
// pull in default implementation
using std::conditional;
#endif // DOXYGEN || !HAVE_STD_CONDITIONAL
////////////////////////////////////////////////////////////////////////
//
// integral_constant (C++0x 20.7.3 "Helper classes")
......
......@@ -13,7 +13,6 @@ install(PROGRAMS
cxx0x_variadic.m4
cxx0x_variadic_constructor_sfinae.m4
cxx11_constexpr.m4
cxx11_conditional.m4
cxx11_final.m4
dune.m4
dune_all.m4
......
......@@ -15,7 +15,6 @@ ALLM4S = \
cxx0x_nullptr.m4 \
cxx0x_variadic.m4 \
cxx0x_variadic_constructor_sfinae.m4 \
cxx11_conditional.m4 \
cxx11_constexpr.m4 \
cxx11_final.m4 \
dune.m4 \
......
# tests for C++11 conditional support
# the associated macro is called HAVE_STD_CONDITIONAL
AC_DEFUN([CXX11_CONDITIONAL_CHECK],[
AC_CACHE_CHECK([for C++11 std::conditional], dune_cv_cxx11_conditional_support, [
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([GXX0X])
AC_LANG_PUSH([C++])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#include <type_traits>
],
[
return std::conditional<true,std::integral_constant<int,0>,void>::type::value;
])],
dune_cv_cxx11_conditional_support=yes,
dune_cv_cxx11_conditional_support=no)
AC_LANG_POP
])
if test "x$dune_cv_cxx11_conditional_support" = xyes; then
AC_DEFINE(HAVE_STD_CONDITIONAL, 1, [Define to 1 if C++11 std::conditional is supported])
fi
])
......@@ -23,7 +23,6 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
AC_REQUIRE([SHARED_PTR])
AC_REQUIRE([VARIADIC_TEMPLATES_CHECK])
AC_REQUIRE([RVALUE_REFERENCES_CHECK])
AC_REQUIRE([CXX11_CONDITIONAL_CHECK])
AC_REQUIRE([CXX11_CONSTEXPR_CHECK])
AC_REQUIRE([DUNE_BOOST_BASE])
AC_REQUIRE([MAKE_SHARED])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment