Skip to content

Commit

Permalink
[FIX] workaround gcc versions that forgot to define __cpp_lib_remove_…
Browse files Browse the repository at this point in the history
…cvref
  • Loading branch information
marehr committed Sep 16, 2020
1 parent 9ec045f commit 4e1d3fb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions include/seqan3/std/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,25 @@

#include <type_traits>

//!\brief A workaround for __cpp_lib_remove_cvref for gcc version >=9.0 and <9.4 (in C++17 mode).
//! Those versions implemented std::remove_cvref_t, but did not define that feature detection macro.
#ifndef SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF
# if defined(__cpp_lib_remove_cvref)
# define SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF 1
# elif defined(__GNUC__) && ((__GNUC__ == 9) && (__GNUC_MINOR__ < 4)) && __cplusplus > 201703L
# define SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF 1
# else
# define SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF 0
# endif
#endif

namespace std
{

// ----------------------------------------------------------------------------
// remove_cvref_t
// ----------------------------------------------------------------------------
#ifndef __cpp_lib_remove_cvref
#if !SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF
/*!\brief Return the input type with `const`, `volatile` and references removed.
* \tparam t The type to operate on.
*/
Expand All @@ -42,7 +54,7 @@ struct remove_cvref<t> // needed for gcc-9, it defines std::remove_cvref but doe
*/
template <typename t>
using remove_cvref_t = typename remove_cvref<t>::type;
#endif // __cpp_lib_remove_cvref
#endif // !SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF

// ----------------------------------------------------------------------------
// type_identity
Expand Down

0 comments on commit 4e1d3fb

Please sign in to comment.