Skip to content

Commit

Permalink
Merge branch 'master' into dev-1-2-1
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidWallOfCode committed Apr 22, 2020
2 parents 40203b0 + 2cfb9b8 commit 0092257
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions code/include/swoc/swoc_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ template<typename T, typename... Types> struct is_any_of {
static constexpr bool value = std::disjunction<std::is_same<T, Types>...>::value;
};

/// Helper variable template for is_any_of
template <typename T, typename... Types>
inline constexpr bool is_any_of_v = is_any_of<T, Types...>::value;

/** Type list support class.
*
* @tparam Types List of types.
Expand Down
1 change: 0 additions & 1 deletion example/ex_netdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ BufferWriter& bwformat(BufferWriter& w, bwf::Spec const& spec, FlagSet const& fl
}
return w;
}

} // namespace SWOC_NAMESPACE

// These are used to keep pointers for the same string identical so the payloads
Expand Down
3 changes: 3 additions & 0 deletions unit_tests/test_meta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ TEST_CASE("Meta Example", "[meta][example]")
REQUIRE(true == swoc::meta::is_any_of<A, A>::value);
REQUIRE(false == swoc::meta::is_any_of<A, D>::value);
REQUIRE(false == swoc::meta::is_any_of<A>::value); // verify degenerate use case.

REQUIRE(true == swoc::meta::is_any_of_v<A, A, B, C>);
REQUIRE(false == swoc::meta::is_any_of_v<D, A, B, C>);
}

// Start of ts::meta testing.
Expand Down

0 comments on commit 0092257

Please sign in to comment.