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

[cleanup] Remove check for rvalue references.

parent 5da88705
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported # HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported
# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported # HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant # HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
# HAVE_CONSTEXPR True if constexpr is supported # HAVE_CONSTEXPR True if constexpr is supported
# HAVE_KEYWORD_FINAL True if final is supported. # HAVE_KEYWORD_FINAL True if final is supported.
...@@ -181,28 +180,6 @@ check_cxx_source_compiles(" ...@@ -181,28 +180,6 @@ check_cxx_source_compiles("
" HAS_ATTRIBUTE_DEPRECATED_MSG " HAS_ATTRIBUTE_DEPRECATED_MSG
) )
# rvalue references
check_cxx_source_compiles("
#include <cassert>
#include <utility>
int foo(int&& x) { return 1; }
int foo(const int& x) { return -1; }
template<typename T>
int forward(T&& x)
{
return foo(std::forward<T>(x));
}
int main(void)
{
int i = 0;
assert( forward(i) + forward(int(2)) == 0);
return 0;
}
" HAVE_RVALUE_REFERENCES
)
# constexpr # constexpr
check_cxx_source_compiles(" check_cxx_source_compiles("
constexpr int foo() constexpr int foo()
......
...@@ -124,9 +124,6 @@ ...@@ -124,9 +124,6 @@
/* end private */ /* end private */
/* Define to 1 if rvalue references are supported */
#cmakedefine HAVE_RVALUE_REFERENCES 1
/* Define to 1 if C++11 constexpr is supported */ /* Define to 1 if C++11 constexpr is supported */
#cmakedefine HAVE_CONSTEXPR 1 #cmakedefine HAVE_CONSTEXPR 1
......
...@@ -129,11 +129,7 @@ namespace Dune ...@@ -129,11 +129,7 @@ namespace Dune
{ {
array<T,n> r; array<T,n> r;
r.fill(t); r.fill(t);
#if HAVE_RVALUE_REFERENCES
return std::move(r); return std::move(r);
#else
return r;
#endif
} }
/** @} */ /** @} */
......
...@@ -277,14 +277,14 @@ namespace Dune ...@@ -277,14 +277,14 @@ namespace Dune
{ {
::new((void*)p)T(val); ::new((void*)p)T(val);
} }
#if HAVE_RVALUE_REFERENCES || DOXYGEN
//! construct an object of type T from variadic parameters //! construct an object of type T from variadic parameters
template<typename ... _Args> template<typename ... _Args>
void construct(pointer p, _Args&&... __args) void construct(pointer p, _Args&&... __args)
{ {
::new((void *)p)T(std::forward<_Args>(__args) ...); ::new((void *)p)T(std::forward<_Args>(__args) ...);
} }
#endif
//! destroy an object of type T (i.e. call the destructor) //! destroy an object of type T (i.e. call the destructor)
void destroy(pointer p) void destroy(pointer p)
{ {
......
...@@ -82,14 +82,14 @@ namespace Dune ...@@ -82,14 +82,14 @@ namespace Dune
{ {
::new((void*)p)T(val); ::new((void*)p)T(val);
} }
#if HAVE_RVALUE_REFERENCES || DOXYGEN
//! construct an object of type T from variadic parameters //! construct an object of type T from variadic parameters
template<typename ... _Args> template<typename ... _Args>
void construct(pointer p, _Args&&... __args) void construct(pointer p, _Args&&... __args)
{ {
::new((void *)p)T(std::forward<_Args>(__args) ...); ::new((void *)p)T(std::forward<_Args>(__args) ...);
} }
#endif
//! destroy an object of type T (i.e. call the destructor) //! destroy an object of type T (i.e. call the destructor)
void destroy(pointer p) void destroy(pointer p)
{ {
......
...@@ -24,9 +24,7 @@ int main() { ...@@ -24,9 +24,7 @@ int main() {
// Test TypeTraits::isReference // Test TypeTraits::isReference
assert( not Dune::TypeTraits<int>::isReference ); assert( not Dune::TypeTraits<int>::isReference );
assert( Dune::TypeTraits<int&>::isReference ); assert( Dune::TypeTraits<int&>::isReference );
#if HAVE_RVALUE_REFERENCES
assert( not Dune::TypeTraits<int&&>::isReference ); assert( not Dune::TypeTraits<int&&>::isReference );
#endif
// Test TypeTraits::PointeeType // Test TypeTraits::PointeeType
assert( (Dune::is_same<Dune::Empty, Dune::TypeTraits<int>::PointeeType>::value) ); assert( (Dune::is_same<Dune::Empty, Dune::TypeTraits<int>::PointeeType>::value) );
...@@ -48,9 +46,7 @@ int main() { ...@@ -48,9 +46,7 @@ int main() {
// Test is_reference // Test is_reference
assert( not Dune::is_lvalue_reference<int>::value ); assert( not Dune::is_lvalue_reference<int>::value );
assert( Dune::is_lvalue_reference<int&>::value ); assert( Dune::is_lvalue_reference<int&>::value );
#if HAVE_RVALUE_REFERENCES
assert( not Dune::is_lvalue_reference<int&&>::value ); assert( not Dune::is_lvalue_reference<int&&>::value );
#endif
// Test remove_pointer // Test remove_pointer
// Note: when the argument T is not a pointer, TypeTraits::PointeeType returns Dune::Empty, // Note: when the argument T is not a pointer, TypeTraits::PointeeType returns Dune::Empty,
...@@ -64,9 +60,7 @@ int main() { ...@@ -64,9 +60,7 @@ int main() {
// Test remove_reference // Test remove_reference
assert( (Dune::is_same<int, Dune::remove_reference<int>::type>::value) ); assert( (Dune::is_same<int, Dune::remove_reference<int>::type>::value) );
assert( (Dune::is_same<int, Dune::remove_reference<int&>::type>::value) ); assert( (Dune::is_same<int, Dune::remove_reference<int&>::type>::value) );
#if HAVE_RVALUE_REFERENCES
assert( (Dune::is_same<int, Dune::remove_reference<int&&>::type>::value) ); assert( (Dune::is_same<int, Dune::remove_reference<int&&>::type>::value) );
#endif
return 0; return 0;
} }
...@@ -8,7 +8,6 @@ install(PROGRAMS ...@@ -8,7 +8,6 @@ install(PROGRAMS
ax_lang_compiler_ms.m4 ax_lang_compiler_ms.m4
boost_fusion.m4 boost_fusion.m4
cxx0x_compiler.m4 cxx0x_compiler.m4
cxx0x_rvaluereference.m4
cxx0x_nullptr.m4 cxx0x_nullptr.m4
cxx11_constexpr.m4 cxx11_constexpr.m4
cxx11_final.m4 cxx11_final.m4
......
...@@ -11,7 +11,6 @@ ALLM4S = \ ...@@ -11,7 +11,6 @@ ALLM4S = \
ax_lang_compiler_ms.m4 \ ax_lang_compiler_ms.m4 \
boost_fusion.m4 \ boost_fusion.m4 \
cxx0x_compiler.m4 \ cxx0x_compiler.m4 \
cxx0x_rvaluereference.m4 \
cxx0x_nullptr.m4 \ cxx0x_nullptr.m4 \
cxx11_constexpr.m4 \ cxx11_constexpr.m4 \
cxx11_final.m4 \ cxx11_final.m4 \
......
# tests compiler support for C++0x rvalue references
# the associated macro is called HAVE_RVALUE_REFERENCES
AC_DEFUN([RVALUE_REFERENCES_CHECK],[
AC_CACHE_CHECK([whether rvalue references are supported], dune_cv_rvalue_references_support, [
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([GXX0X])
AC_LANG_PUSH([C++])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([#include<cassert>
#include <utility>
int foo(int&& x) { return 1; }
int foo(const int& x) { return -1; }
template<typename T>
int forward(T&& x)
{
return foo(std::forward<T>(x));
}],
[
int i = 0;
assert( forward(i) + forward(int(2)) == 0);
return 0;
])],
dune_cv_rvalue_references_support=yes,
dune_cv_rvalue_references_support=no)
AC_LANG_POP
])
if test "x$dune_cv_rvalue_references_support" = xyes; then
AC_DEFINE(HAVE_RVALUE_REFERENCES, 1, [Define to 1 if rvalue references are supported])
fi
])
...@@ -20,7 +20,6 @@ AC_DEFUN([DUNE_COMMON_CHECKS], ...@@ -20,7 +20,6 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
AC_REQUIRE([DUNE_CHECK_COMPILER]) AC_REQUIRE([DUNE_CHECK_COMPILER])
AC_REQUIRE([GXX0X]) AC_REQUIRE([GXX0X])
AC_REQUIRE([NULLPTR_CHECK]) AC_REQUIRE([NULLPTR_CHECK])
AC_REQUIRE([RVALUE_REFERENCES_CHECK])
AC_REQUIRE([CXX11_CONSTEXPR_CHECK]) AC_REQUIRE([CXX11_CONSTEXPR_CHECK])
AC_REQUIRE([DUNE_BOOST_BASE]) AC_REQUIRE([DUNE_BOOST_BASE])
AC_REQUIRE([DUNE_LINKCXX]) AC_REQUIRE([DUNE_LINKCXX])
......
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