Skip to content

Commit

Permalink
Some internal renaming (for clarity)
Browse files Browse the repository at this point in the history
  • Loading branch information
OleErikPeistorpet committed Jun 14, 2024
1 parent b3162e5 commit b6ae29d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
8 changes: 4 additions & 4 deletions auxi/assignable.h → auxi/detail_assignable.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ namespace oel::_detail
OEL_ALWAYS_INLINE constexpr operator T &() { return _val; }
};

using Empty_type_MSVC_unique_name = T;
using EmptyType_7KQw = T;

struct ImplEmpty : Empty_type_MSVC_unique_name
struct ImplEmpty : EmptyType_7KQw
{
constexpr ImplEmpty(Empty_type_MSVC_unique_name src) noexcept
: Empty_type_MSVC_unique_name(src) {}
constexpr ImplEmpty(EmptyType_7KQw src) noexcept
: EmptyType_7KQw(src) {}

ImplEmpty() = default;
ImplEmpty(const ImplEmpty &) = default;
Expand Down
17 changes: 9 additions & 8 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,20 @@ namespace _detail
OEL_ALWAYS_INLINE constexpr U & second() { return _sec; }
};

template< typename Type_unique_name_for_MSVC, typename Empty_type_MSVC_unique_name >
struct TightPair<Type_unique_name_for_MSVC, Empty_type_MSVC_unique_name, true>
: Empty_type_MSVC_unique_name
// MSVC needs unique names to guard against name collision due to inheritance
template< typename FirstType_7KQw, typename EmptyType_7KQw >
struct TightPair<FirstType_7KQw, EmptyType_7KQw, true>
: EmptyType_7KQw
{
Type_unique_name_for_MSVC first;
FirstType_7KQw first;

TightPair() = default;
constexpr TightPair(Type_unique_name_for_MSVC f, Empty_type_MSVC_unique_name s)
: Empty_type_MSVC_unique_name{s}, first{std::move(f)}
constexpr TightPair(FirstType_7KQw f, EmptyType_7KQw s)
: EmptyType_7KQw{s}, first{std::move(f)}
{}

OEL_ALWAYS_INLINE constexpr const Empty_type_MSVC_unique_name & second() const { return *this; }
OEL_ALWAYS_INLINE constexpr Empty_type_MSVC_unique_name & second() { return *this; }
OEL_ALWAYS_INLINE constexpr const EmptyType_7KQw & second() const { return *this; }
OEL_ALWAYS_INLINE constexpr EmptyType_7KQw & second() { return *this; }
};
}

Expand Down
2 changes: 1 addition & 1 deletion view/generate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


#include "counted.h"
#include "../auxi/assignable.h"
#include "../auxi/detail_assignable.h"

/** @file
*/
Expand Down
14 changes: 7 additions & 7 deletions view/transform_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


#include "../util.h" // for TightPair
#include "../auxi/assignable.h"
#include "../auxi/detail_assignable.h"

/** @file
*/
Expand Down Expand Up @@ -51,16 +51,16 @@ template< typename UnaryFunc, typename Iterator >
class transform_iterator
: private _detail::TransformIterBase<UnaryFunc, Iterator>
{
using _base = typename transform_iterator::TransformIterBase;
using _super = typename transform_iterator::TransformIterBase;

using _base::m;
using _super::m;

static constexpr auto _isBidirectional = iter_is_bidirectional<Iterator>;

public:
using iterator_category =
std::conditional_t<
std::is_copy_constructible_v<UnaryFunc> and _base::canCallConst,
std::is_copy_constructible_v<UnaryFunc> and _super::canCallConst,
std::conditional_t<
_isBidirectional,
std::bidirectional_iterator_tag,
Expand All @@ -69,20 +69,20 @@ class transform_iterator
std::input_iterator_tag
>;
using difference_type = iter_difference_t<Iterator>;
using reference = decltype( std::declval<typename _base::FnRef>()(*m.first) );
using reference = decltype( std::declval<typename _super::FnRef>()(*m.first) );
using pointer = void;
using value_type = std::remove_cv_t< std::remove_reference_t<reference> >;

transform_iterator() = default;
constexpr transform_iterator(UnaryFunc f, Iterator it) : _base{{std::move(it), std::move(f)}} {}
constexpr transform_iterator(UnaryFunc f, Iterator it) : _super{{std::move(it), std::move(f)}} {}

constexpr Iterator base() && { return std::move(m.first); }
constexpr Iterator base() const && { return m.first; }
constexpr const Iterator & base() const & noexcept OEL_ALWAYS_INLINE { return m.first; }

constexpr reference operator*() const
{
typename _base::FnRef f = m.second();
typename _super::FnRef f = m.second();
return f(*m.first);
}

Expand Down

0 comments on commit b6ae29d

Please sign in to comment.