aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2020-02-22 17:16:23 +0100
committerFelix Morgner <felix.morgner@gmail.com>2020-02-22 17:16:23 +0100
commitc4e3450fb1de240ec10eea27e8b9079cab5f8a55 (patch)
treec3c9ed6efa9b325011bc47992263e8ff7a634eaf
parentda08fcb57fd7276649af800a61ee9c008026b6c2 (diff)
downloadnewtype-c4e3450fb1de240ec10eea27e8b9079cab5f8a55.tar.xz
newtype-c4e3450fb1de240ec10eea27e8b9079cab5f8a55.zip
new_type: adjust enablement of begin
-rw-r--r--include/newtype/new_type.hpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/include/newtype/new_type.hpp b/include/newtype/new_type.hpp
index 0aa1a2e..ef36a75 100644
--- a/include/newtype/new_type.hpp
+++ b/include/newtype/new_type.hpp
@@ -224,17 +224,9 @@ namespace nt
*/
template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::Iterable)> * = nullptr>
auto constexpr begin()
- -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_begin_v<BaseType>, typename NewType::iterator>
+ -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_begin_v<BaseType>, typename NewType::iterator>
{
- if constexpr (impl::has_member_begin_v<BaseType>)
- {
- return this->m_value.begin();
- }
- else
- {
- using std::begin;
- return begin(this->m_value);
- }
+ return this->m_value.begin();
}
/**
@@ -245,18 +237,10 @@ namespace nt
* @throw Any exception thrown by the overload of 'begin' selected
*/
template<typename NewType = new_type>
- auto constexpr begin() const
- -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_begin_v<BaseType const>, typename NewType::const_iterator>
+ auto constexpr begin() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_begin_v<BaseType const>,
+ typename NewType::const_iterator>
{
- if constexpr (impl::has_member_begin_v<BaseType>)
- {
- return this->m_value.begin();
- }
- else
- {
- using std::begin;
- return begin(this->m_value);
- }
+ return this->m_value.begin();
}
};