sprinkle in some constexpr

This commit is contained in:
Matthew Kennedy 2023-07-01 20:41:44 -07:00
parent eb29861087
commit cef8b61c7c
2 changed files with 10 additions and 10 deletions

View File

@ -158,7 +158,7 @@ public:
* Slightly shorter helper function to keep the code looking clean.
*/
template<typename get_t>
auto & module() {
constexpr auto & module() {
return engineModules.get<get_t>();
}

View File

@ -63,13 +63,13 @@ struct type_list {
* The return type is type_list<get_t> or type_list<Mockable<get_t>>
*/
template<typename get_t>
auto get() -> std::enable_if_t<decltype(first)::template has<get_t>(),
constexpr auto get() -> std::enable_if_t<decltype(first)::template has<get_t>(),
decltype(first.template get<get_t>())> {
return first.template get<get_t>();
}
template<typename get_t>
auto get() -> std::enable_if_t<!decltype(first)::template has<get_t>(),
constexpr auto get() -> std::enable_if_t<!decltype(first)::template has<get_t>(),
decltype(others.template get<get_t>())> {
return others.template get<get_t>();
}
@ -111,19 +111,19 @@ public:
}
template<typename get_t, typename = std::enable_if_t<has<get_t>()>>
auto & get() {
constexpr auto & get() {
return *this;
}
auto & unmock() {
constexpr auto & unmock() {
return me;
}
base_t * operator->() {
constexpr base_t * operator->() {
return &me;
}
base_t & operator*() {
constexpr base_t & operator*() {
return me;
}
};
@ -170,7 +170,7 @@ public:
}
template<typename get_t, typename = std::enable_if_t<has<get_t>()>>
auto & get() {
constexpr auto & get() {
return *this;
}
@ -186,11 +186,11 @@ public:
}
}
auto * operator->() {
constexpr auto * operator->() {
return cur;
}
auto & operator*() {
constexpr auto & operator*() {
return *cur;
}