aui icon indicating copy to clipboard operation
aui copied to clipboard

aui::container adapt to aui::range

Open Alex2772 opened this issue 3 years ago • 0 comments

At the moment, some of aui::container functions (aui.core/src/AUI/Traits/containers.h) accept Iterator begin, Iterator end. aui::range is designed for such situation, but weren't used here.

Also, some new methods for aui::range may be implemented. Maybe it's a very good idea to move all the functionality of aui::container namespace to aui::range methods (see example).

Example

Currently (bad):

template<typename Iterator>
[[nodiscard]]
bool contains(Iterator begin, Iterator end, const typename std::iterator_traits<Iterator>::value_type& value) noexcept {
    return std::find(begin, end, value) != end;
}

Expected (good):

template<typename Iterator>
[[nodiscard]]
bool contains(const typename std::iterator_traits<Iterator>::value_type& value) noexcept {
    return std::find(begin(), end(), value) != end;
}

Alex2772 avatar Oct 31 '22 16:10 Alex2772