Skip to content

Commit

Permalink
Use less typename
Browse files Browse the repository at this point in the history
  • Loading branch information
jimporter committed Aug 2, 2024
1 parent c6b57ca commit 72e13a9
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions include/mettle/detail/forward_if.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ namespace mettle::detail {

template<typename Container, typename Element>
struct ref_if {
using type = typename std::conditional<
std::is_lvalue_reference<Container>::value,
typename std::remove_reference<Element>::type &,
typename std::remove_reference<Element>::type &&
>::type;
using type = std::conditional_t<
std::is_lvalue_reference_v<Container>,
std::remove_reference_t<Element> &,
std::remove_reference_t<Element> &&
>;
};

template<typename Container, typename Element>
inline decltype(auto)
forward_if(Element &&value) {
return static_cast<typename ref_if<Container, Element>::type>(value);
return static_cast<ref_if<Container, Element>::type>(value);
}

} // namespace mettle::detail
Expand Down
4 changes: 2 additions & 2 deletions include/mettle/detail/tuple_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ namespace mettle::detail {

template<typename Tuple, typename Func>
void tuple_for_each(Tuple &&tuple, Func &&f) {
using T = typename std::remove_reference<Tuple>::type;
static_for<std::tuple_size<T>::value>([&](auto i) {
using T = std::remove_reference_t<Tuple>;
static_for<std::tuple_size_v<T>>([&](auto i) {
return f(std::get<decltype(i)::value>(tuple));
});
}
Expand Down
2 changes: 1 addition & 1 deletion include/mettle/driver/log/indent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace mettle {
class basic_indenting_streambuf : public std::basic_streambuf<Char, Traits> {
public:
using base_type = std::basic_streambuf<Char, Traits>;
using int_type = typename base_type::int_type;
using int_type = base_type::int_type;

basic_indenting_streambuf(base_type *buf, std::size_t base_indent = 2)
: buf_(buf), base_indent_(base_indent) {}
Expand Down
2 changes: 1 addition & 1 deletion include/mettle/driver/object_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace mettle {
using result_type = Result;
using function_type = std::function<result_type(Args...)>;
using container_type = std::map<std::string, function_type>;
using iterator = typename container_type::const_iterator;
using iterator = container_type::const_iterator;

void add(std::string name, function_type f) {
registry_.emplace(std::move(name), std::move(f));
Expand Down
2 changes: 1 addition & 1 deletion include/mettle/matchers/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace mettle {
> {};

template<typename T>
using ensure_matcher_t = typename ensure_matcher_type<T>::type;
using ensure_matcher_t = ensure_matcher_type<T>::type;

template<typename T>
inline auto is_not(T &&thing) {
Expand Down
2 changes: 1 addition & 1 deletion include/mettle/output/to_printable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace mettle {
}
} else if constexpr(std::is_enum_v<T>) {
return type_name<T>() + "(" + std::to_string(
static_cast<typename std::underlying_type<T>::type>(t)
static_cast<std::underlying_type_t<T>>(t)
) + ")";
} else if constexpr(std::is_same_v<std::remove_cv_t<T>, bool>) {
return t ? "true" : "false";
Expand Down
2 changes: 1 addition & 1 deletion include/mettle/suite/compiled_suite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace mettle {
friend class compiled_suite;
public:
using test_info = basic_test_info<Function>;
using iterator = typename std::vector<test_info>::const_iterator;
using iterator = std::vector<test_info>::const_iterator;

template<typename String, typename Tests, typename Subsuites,
typename Compile>
Expand Down
12 changes: 6 additions & 6 deletions include/mettle/suite/make_suite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ namespace mettle {
struct wrapped_suite<Wrap, Builder, std::void_t<
typename Wrap::compiled_suite_type
>> {
using type = typename Wrap::compiled_suite_type;
using type = Wrap::compiled_suite_type;
};

template<typename Builder, typename Wrap>
typename wrapped_suite<Wrap, Builder>::type
wrapped_suite<Wrap, Builder>::type
finalize(Builder &b, const Wrap &wrap) {
return {
std::move(b.name_), std::move(b.tests_), std::move(b.subsuites_),
Expand Down Expand Up @@ -323,7 +323,7 @@ namespace mettle {
};

template<typename Factory, typename Parent, typename InChild>
using suite_builder_base_t = typename suite_builder_base_type<
using suite_builder_base_t = suite_builder_base_type<
Factory, Parent, InChild
>::type;

Expand All @@ -344,7 +344,7 @@ namespace mettle {
using test_caller = detail::test_caller<Factory, ParentFixture, Fixture>;

template<typename Builder, typename Wrap>
friend typename detail::wrapped_suite<Wrap, Builder>::type
friend detail::wrapped_suite<Wrap, Builder>::type
detail::finalize(Builder &, const Wrap &);

factory_type factory_;
Expand Down Expand Up @@ -391,11 +391,11 @@ namespace mettle {

template<typename T>
struct fixture_type {
using type = typename std::remove_reference_t<T>::fixture_type;
using type = std::remove_reference_t<T>::fixture_type;
};

template<typename T>
using fixture_type_t = typename fixture_type<T>::type;
using fixture_type_t = fixture_type<T>::type;

} // namespace mettle

Expand Down
2 changes: 1 addition & 1 deletion test/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace mettle {
return basic_matcher(
ensure_matcher(std::forward<T>(thing)),
[](const boost::any &actual, auto &&matcher) -> match_result {
using ValueType = typename std::remove_reference<Type>::type;
using ValueType = std::remove_reference_t<Type>;
auto value = boost::any_cast<ValueType>(&actual);
if(!value)
return {
Expand Down
2 changes: 1 addition & 1 deletion test/suite/test_test_caller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct run_counter_from_tuple_t<std::tuple<T...>> {
};

template<typename Tuple>
using run_counter_from_tuple = typename run_counter_from_tuple_t<Tuple>::type;
using run_counter_from_tuple = run_counter_from_tuple_t<Tuple>::type;

using namespace mettle::detail;

Expand Down

0 comments on commit 72e13a9

Please sign in to comment.