diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-07-02 05:49:47 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-07-02 05:49:47 +0100 |
| commit | ebe4cb0bdeabd06a31072547af47cacaab7f78c0 (patch) | |
| tree | 65a81c2c86260b595107ee6c5505583f9afaf39d /nihil.generator/elements_of.ccm | |
| parent | 5adeb648f74c1771164c0686d6e0fc584cf36d9e (diff) | |
| download | nihil-ebe4cb0bdeabd06a31072547af47cacaab7f78c0.tar.gz nihil-ebe4cb0bdeabd06a31072547af47cacaab7f78c0.tar.bz2 | |
replace nihil::generator
the new implementation is much simpler and PD-licensed. the only
downside is it doesn't support elements_of.
while here, move it to nihil.core.
Diffstat (limited to 'nihil.generator/elements_of.ccm')
| -rw-r--r-- | nihil.generator/elements_of.ccm | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/nihil.generator/elements_of.ccm b/nihil.generator/elements_of.ccm deleted file mode 100644 index 74c8b76..0000000 --- a/nihil.generator/elements_of.ccm +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Reference implementation of std::generator proposal P2168. -// -// See https://wg21.link/P2168 for details. -// -/////////////////////////////////////////////////////////////////////////////// -// Copyright Lewis Baker, Corentin Jabot -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. -// (See accompanying file LICENSE or http://www.boost.org/LICENSE_1_0.txt) -/////////////////////////////////////////////////////////////////////////////// - -export module nihil.generator:elements_of; - -import nihil.std; -import :util; - -namespace nihil { - -export template <typename Range, typename Allocator = use_allocator_arg> -struct elements_of { - explicit constexpr elements_of(Range &&range) noexcept - requires std::is_default_constructible_v<Allocator> - : m_range(static_cast<Range &&>(range)) - { - } - - constexpr elements_of(Range &&range, Allocator &&alloc) noexcept - : m_range(static_cast<Range &&>(range)) - , m_alloc(static_cast<Allocator &&>(alloc)) - {} - - constexpr elements_of(elements_of &&) noexcept = default; - - constexpr elements_of(const elements_of &) = delete; - - constexpr auto operator=(this elements_of &, const elements_of &) - -> elements_of & = delete; - constexpr auto operator=(this elements_of &, elements_of &&) noexcept - -> elements_of & = delete; - - [[nodiscard]] constexpr auto - get(this elements_of const &self) noexcept -> Range && - { - return static_cast<Range &&>(self.m_range); - } - - [[nodiscard]] constexpr auto - get_allocator(this elements_of const &self) noexcept -> Allocator - { - return self.m_alloc; - } - -private: - [[no_unique_address]] Allocator m_alloc; - Range &&m_range; -}; - -export template <typename Range> -elements_of(Range &&) -> elements_of<Range>; - -export template <typename Range, typename Allocator> -elements_of(Range &&, Allocator &&) -> elements_of<Range, Allocator>; - -} // namespace nihil |
