Skip to content

Commit

Permalink
Fix usage of enable_if with GCC 8
Browse files Browse the repository at this point in the history
Seems like the trick with the three dots isn't working
with GCC 8 anymore. So let's make it a default template
parameter then.

Not sure whether GCC 8 is here correct and whether this
workaround causes further trouble.
  • Loading branch information
Martchus committed May 7, 2018
1 parent 36463cd commit 8628427
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion generator/tests/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using TestUtilities::operator<<;
/*!
* \brief Asserts equality of two iteratables printing the differing indices.
*/
template <typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>>...>
template <typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>>* = nullptr>
inline void assertEqualityLinewise(const Iteratable &iteratable1, const Iteratable &iteratable2)
{
std::vector<std::string> differentLines;
Expand Down
10 changes: 5 additions & 5 deletions lib/json/errorhandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ enum class JsonType : byte {
// define helper functions which return the JsonType for the C++ type specified as template parameter

template <typename Type,
Traits::EnableIf<Traits::Not<std::is_same<Type, bool>>, Traits::Any<std::is_integral<Type>, std::is_floating_point<Type>>>...>
Traits::EnableIf<Traits::Not<std::is_same<Type, bool>>, Traits::Any<std::is_integral<Type>, std::is_floating_point<Type>>>* = nullptr>
constexpr JsonType jsonType()
{
return JsonType::Number;
}

template <typename Type, Traits::EnableIfAny<std::is_same<Type, bool>>...> constexpr JsonType jsonType()
template <typename Type, Traits::EnableIfAny<std::is_same<Type, bool>>* = nullptr> constexpr JsonType jsonType()
{
return JsonType::Bool;
}

template <typename Type, Traits::EnableIfAny<Traits::IsString<Type>, Traits::IsCString<Type>>...> constexpr JsonType jsonType()
template <typename Type, Traits::EnableIfAny<Traits::IsString<Type>, Traits::IsCString<Type>>* = nullptr> constexpr JsonType jsonType()
{
return JsonType::String;
}

template <typename Type,
Traits::EnableIf<Traits::IsIteratable<Type>,
Traits::Not<Traits::Any<Traits::IsString<Type>, Traits::IsSpecializationOf<Type, std::map>,
Traits::IsSpecializationOf<Type, std::unordered_map>>>>...>
Traits::IsSpecializationOf<Type, std::unordered_map>>>>* = nullptr>
constexpr JsonType jsonType()
{
return JsonType::Array;
Expand All @@ -73,7 +73,7 @@ template <typename Type,
Traits::DisableIfAny<std::is_integral<Type>, std::is_floating_point<Type>, Traits::IsString<Type>, Traits::IsCString<Type>,
Traits::All<Traits::IsIteratable<Type>,
Traits::Not<Traits::Any<Traits::IsString<Type>, Traits::IsSpecializationOf<Type, std::map>,
Traits::IsSpecializationOf<Type, std::unordered_map>>>>>...>
Traits::IsSpecializationOf<Type, std::unordered_map>>>>>* = nullptr>
constexpr JsonType jsonType()
{
return JsonType::Object;
Expand Down
4 changes: 2 additions & 2 deletions lib/json/reflector-boosthana.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace JsonReflector {

// define function to "push" values to a RapidJSON array or object

template <typename Type, Traits::DisableIf<IsBuiltInType<Type>>...>
template <typename Type, Traits::DisableIf<IsBuiltInType<Type>>*>
void push(const Type &reflectable, RAPIDJSON_NAMESPACE::Value::Object &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
{
boost::hana::for_each(boost::hana::keys(reflectable), [&reflectable, &value, &allocator](auto key) {
Expand All @@ -36,7 +36,7 @@ void push(const Type &reflectable, RAPIDJSON_NAMESPACE::Value::Object &value, RA

// define function to "pull" values from a RapidJSON array or object

template <typename Type, Traits::DisableIf<IsBuiltInType<Type>>...>
template <typename Type, Traits::DisableIf<IsBuiltInType<Type>>*>
void pull(Type &reflectable, const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>>::ConstObject &value,
JsonDeserializationErrors *errors)
{
Expand Down
Loading

0 comments on commit 8628427

Please sign in to comment.