rs-core

Core utilities


Project maintained by CaptainCrowbar Hosted on GitHub Pages — Theme by mattgraham

Global Utilities

Core utility library by Ross Smith

#include "rs-core/global.hpp"
namespace RS;

Contents

Constants

constexpr std::string_view ascii_whitespace = "\t\n\r ";
constexpr auto npos = ~ 0uz;

Defined for convenience.

Concepts

template <typename R, typename V> concept ReadableRange;
template <typename R, typename V> concept WritableRange;
template <typename R, typename V> concept ReadWriteRange
    = ReadableRange<R, V> && WritableRange<R, V>;

Range concepts compatible with specific value types. All of these require R to be a range. ReadableRange also requires a dereferenced iterator to be assignable to a V object; WritableRange also requires a dereferenced iterator to be assignable from a V object; ReadWriteRange requires both.

Metaprogramming utilities

template <typename> constexpr bool dependent_false = false;

Used when the equivalent of static_assert(false) is needed in a dependent context.

Range functions

template <std::input_or_output_iterator I, std::sentinel_for<I> S>
std::ranges::subrange<I, S> as_range(std::pair<I, S> pair) noexcept {
    return std::ranges::subrange(pair.first, pair.second);
}

Turns an iterator pair returned by equal_range() into an actual range.