C++14 and later CRTP templates for defining iterators, views, and containers
An updated C++20-friendly version of the iterator_facade
and
iterator_adaptor
parts of Boost.Iterator (now called iterator_interface
);
a pre-C++20 version of C++20's view_interface
; and a new template called
container_interface
, meant to aid the creation of new containers; all
targeting standardization. This library requires at least C++14.
For the iterator portion -- if you need to write an iterator, iterator_interface
turns this:
struct repeated_chars_iterator
{
using value_type = char;
using difference_type = std::ptrdiff_t;
using pointer = char const *;
using reference = char const;
using iterator_category = std::random_access_iterator_tag;
constexpr repeated_chars_iterator() noexcept :
first_(nullptr),
size_(0),
n_(0)
{}
constexpr repeated_chars_iterator(
char const * first,
difference_type size,
difference_type n) noexcept :
first_(first),
size_(size),
n_(n)
{}
constexpr reference operator*() const noexcept
{
return first_[n_ % size_];
}
constexpr value_type operator[](difference_type n) const noexcept
{
return first_[(n_ + n) % size_];
}
constexpr repeated_chars_iterator & operator++() noexcept
{
++n_;
return *this;
}
constexpr repeated_chars_iterator operator++(int)noexcept
{
repeated_chars_iterator retval = *this;
++*this;
return retval;
}
constexpr repeated_chars_iterator & operator+=(difference_type n) noexcept
{
n_ += n;
return *this;
}
constexpr repeated_chars_iterator & operator--() noexcept
{
--n_;
return *this;
}
constexpr repeated_chars_iterator operator--(int)noexcept
{
repeated_chars_iterator retval = *this;
--*this;
return retval;
}
constexpr repeated_chars_iterator & operator-=(difference_type n) noexcept
{
n_ -= n;
return *this;
}
friend constexpr bool operator==(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return lhs.first_ == rhs.first_ && lhs.n_ == rhs.n_;
}
friend constexpr bool operator!=(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return !(lhs == rhs);
}
friend constexpr bool operator<(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return lhs.first_ == rhs.first_ && lhs.n_ < rhs.n_;
}
friend constexpr bool operator<=(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return lhs == rhs || lhs < rhs;
}
friend constexpr bool operator>(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return rhs < lhs;
}
friend constexpr bool operator>=(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return rhs <= lhs;
}
friend constexpr repeated_chars_iterator
operator+(repeated_chars_iterator lhs, difference_type rhs) noexcept
{
return lhs += rhs;
}
friend constexpr repeated_chars_iterator
operator+(difference_type lhs, repeated_chars_iterator rhs) noexcept
{
return rhs += lhs;
}
friend constexpr repeated_chars_iterator
operator-(repeated_chars_iterator lhs, difference_type rhs) noexcept
{
return lhs -= rhs;
}
friend constexpr difference_type operator-(
repeated_chars_iterator lhs, repeated_chars_iterator rhs) noexcept
{
return lhs.n_ - rhs.n_;
}
private:
char const * first_;
difference_type size_;
difference_type n_;
};
Depends (2)
Builds
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_16_libc++-O3 |
timestamp |
2024-04-25 19:46:16 UTC (05:43:11 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_16_libc++-static_O3 |
timestamp |
2024-04-25 19:42:36 UTC (05:46:50 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_16_libc++ |
timestamp |
2024-04-25 19:34:06 UTC (05:55:21 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-clang_15.0-static_O3 |
timestamp |
2024-04-25 14:03:29 UTC (11:25:58 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_11-gcc_12 |
timestamp |
2024-04-25 12:49:39 UTC (12:39:48 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-clang_14.0-static_O3 |
timestamp |
2024-04-25 11:06:39 UTC (14:22:47 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-clang_14.0-O3 |
timestamp |
2024-04-25 11:05:57 UTC (14:23:30 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-clang_14.0 |
timestamp |
2024-04-25 11:05:14 UTC (14:24:13 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_16-static_O3 |
timestamp |
2024-04-25 10:51:23 UTC (14:38:03 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_16-O3 |
timestamp |
2024-04-25 10:50:47 UTC (14:38:40 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_16 |
timestamp |
2024-04-25 10:50:12 UTC (14:39:14 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-gcc_13-static_O3 |
timestamp |
2024-04-25 10:37:57 UTC (14:51:30 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-gcc_13-O3 |
timestamp |
2024-04-25 10:34:43 UTC (14:54:43 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-gcc_13-ndebug_O3 |
timestamp |
2024-04-25 10:33:35 UTC (14:55:52 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-gcc_13 |
timestamp |
2024-04-25 10:33:33 UTC (14:55:53 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_15_libc++ |
timestamp |
2024-04-25 10:27:30 UTC (15:01:57 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
aarch64-linux-gnu |
tgt config |
linux_debian_12-clang_15 |
timestamp |
2024-04-25 10:26:44 UTC (15:02:43 hours ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-clang_15.0-O3 |
timestamp |
2024-04-25 10:00:14 UTC (15:29:13 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-clang_15.0 |
timestamp |
2024-04-25 09:59:32 UTC (15:29:54 hours ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_fedora_37-gcc_12.2-bindist |
timestamp |
2024-04-25 01:03:27 UTC (01 00:25:59 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-gcc_12-bindist |
timestamp |
2024-04-24 18:01:37 UTC (01 07:27:49 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-clang_16.0_llvm_msvc_17.6 |
timestamp |
2024-04-24 17:00:29 UTC (01 08:28:57 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-clang_16.0_llvm_msvc_17.6-O2 |
timestamp |
2024-04-24 16:45:10 UTC (01 08:44:16 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-clang_16.0_llvm_msvc_17.6-static_O2 |
timestamp |
2024-04-24 16:44:42 UTC (01 08:44:45 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_16.0_libc++-static_O3 |
timestamp |
2024-04-24 16:31:14 UTC (01 08:58:13 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_16.0_libc++-O3 |
timestamp |
2024-04-24 16:28:57 UTC (01 09:00:30 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_16.0_libc++ |
timestamp |
2024-04-24 16:27:42 UTC (01 09:01:45 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-msvc_17.6-static_O2 |
timestamp |
2024-04-24 15:47:50 UTC (01 09:41:37 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-msvc_17.6-O2 |
timestamp |
2024-04-24 15:46:52 UTC (01 09:42:35 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-w64-mingw32 |
tgt config |
windows_10-gcc_12.2_mingw_w64-static_O2 |
timestamp |
2024-04-24 15:45:48 UTC (01 09:43:38 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-msvc_17.6 |
timestamp |
2024-04-24 15:45:43 UTC (01 09:43:44 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-w64-mingw32 |
tgt config |
windows_10-gcc_12.2_mingw_w64 |
timestamp |
2024-04-24 15:45:20 UTC (01 09:44:07 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-w64-mingw32 |
tgt config |
windows_10-gcc_12.2_mingw_w64-O2 |
timestamp |
2024-04-24 15:24:15 UTC (01 10:05:11 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-msvc_17.5 |
timestamp |
2024-04-24 14:29:42 UTC (01 10:59:45 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_11-gcc_12.1 |
timestamp |
2024-04-24 14:15:53 UTC (01 11:13:34 days ago) |
result |
success | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-microsoft-win32-msvc14.3 |
tgt config |
windows_10-clang_15.0_msvc_msvc_17.6 |
timestamp |
2024-04-24 11:23:15 UTC (01 14:06:11 days ago) |
result |
warning (update) | warning (test-installed) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_fedora_38-gcc_13-bindist |
timestamp |
2024-04-24 10:55:13 UTC (01 14:34:14 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_16.0 |
timestamp |
2024-04-24 10:44:01 UTC (01 14:45:26 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_16.0-static_O3 |
timestamp |
2024-04-24 10:43:47 UTC (01 14:45:40 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_16.0-O3 |
timestamp |
2024-04-24 10:42:50 UTC (01 14:46:37 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-freebsd13.2 |
tgt config |
freebsd_13-clang_14.0-static_O3 |
timestamp |
2024-04-24 10:32:04 UTC (01 14:57:23 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-gcc_13.1-O3 |
timestamp |
2024-04-24 10:31:29 UTC (01 14:57:58 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-gcc_13.1 |
timestamp |
2024-04-24 10:30:52 UTC (01 14:58:35 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-freebsd13.2 |
tgt config |
freebsd_13-clang_14.0 |
timestamp |
2024-04-24 10:30:50 UTC (01 14:58:37 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-gcc_13.1-ndebug_O3 |
timestamp |
2024-04-24 10:30:49 UTC (01 14:58:37 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-gcc_13.1-static_O3 |
timestamp |
2024-04-24 10:30:05 UTC (01 14:59:22 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-freebsd13.2 |
tgt config |
freebsd_13-clang_14.0-O3 |
timestamp |
2024-04-24 10:29:51 UTC (01 14:59:35 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_15.0 |
timestamp |
2024-04-24 10:29:37 UTC (01 14:59:49 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-freebsd12.4 |
tgt config |
freebsd_12-clang_13.0 |
timestamp |
2024-04-24 10:29:14 UTC (01 15:00:13 days ago) |
result |
error (update) | log | rebuild |
toolchain |
public-0.16.0 |
target |
x86_64-linux-gnu |
tgt config |
linux_debian_12-clang_15.0_libc++ |
timestamp |
2024-04-24 10:29:12 UTC (01 15:00:15 days ago) |
result |
error (update) | log | rebuild |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-gcc_13_homebrew |
result |
excluded (https://github) |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-gcc_13_homebrew-O3 |
result |
excluded (https://github) |
target |
x86_64-apple-darwin22.5.0 |
tgt config |
macos_13-gcc_13_homebrew-static_O3 |
result |
excluded (https://github) |