Skip to content

Commit

Permalink
common: add a custom implementation of std::void_t for C++11 backward…
Browse files Browse the repository at this point in the history
…s compatibility
  • Loading branch information
andrea-iob committed Jun 7, 2024
1 parent 3302bc7 commit 11dd63d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/common/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,24 @@ do { \
*/
#define BITPIT_COMMA ,


/*!
* \ingroup common_misc
*
* Custom implementation of std::void_t for C++11 backwards compatibility.
*/
#if __cplusplus < 201703L
template <class...>
struct make_void { using type = void; };

template <typename... T>
using void_t = typename make_void<T...>::type;

template <typename... T>
using bitpit_void_t = void_t<T>;
#else
template <typename... T>
using bitpit_void_t = std::void_t<T>;
#endif

#endif
2 changes: 1 addition & 1 deletion src/discretization/stencil_weight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DiscreteStencilWeightValueInfo
};

template <typename weight_t>
class DiscreteStencilWeightValueInfo<weight_t, std::void_t<typename weight_t::value_type>>
class DiscreteStencilWeightValueInfo<weight_t, bitpit_void_t<typename weight_t::value_type>>
{
public:
using type = typename weight_t::value_type;
Expand Down

0 comments on commit 11dd63d

Please sign in to comment.