CARVIEW |
Select Language
HTTP/2 302
date: Wed, 23 Jul 2025 18:45:36 GMT
content-type: text/html; charset=utf-8
content-length: 0
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
access-control-allow-origin:
location: https://raw.githubusercontent.com/tcbrindle/NanoRange/master/single_include/nanorange.hpp
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
x-github-request-id: BE90:941DF:FF1850:12DF02C:68812DD0
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"bcc1ab2207c015f8a48f6a925e1ad14cd06314120d55a1e689aeec0b325fddd3"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 56C5:3CF0C7:1AB02B:3BF960:68812DD0
content-encoding: gzip
accept-ranges: bytes
date: Wed, 23 Jul 2025 18:45:36 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210076-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753296336.467779,VS0,VE298
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 6016190f1f9eede0c3f5dcdff3714a7f7459de2d
expires: Wed, 23 Jul 2025 18:50:36 GMT
source-age: 0
content-length: 71426
// nanorange.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_HPP_INCLUDED
#define NANORANGE_HPP_INCLUDED
// nanorange/algorithm.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_ALGORITHM_HPP_INCLUDED
#define NANORANGE_ALGORITHM_HPP_INCLUDED
// Algorithms reimplemented in Nanorange
// nanorange/algorithm/adjacent_find.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_ALGORITHM_ADJACENT_FIND_HPP_INCLUDED
#define NANORANGE_ALGORITHM_ADJACENT_FIND_HPP_INCLUDED
// nanorange/range.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_RANGES_HPP_INCLUDED
#define NANORANGE_RANGES_HPP_INCLUDED
// nanorange/detail/iterator/algorithm_requirements.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_ITERATOR_ALGORITHM_REQUIREMENTS_HPP_INCLUDED
#define NANORANGE_DETAIL_ITERATOR_ALGORITHM_REQUIREMENTS_HPP_INCLUDED
// nanorange/detail/functional/comparisons.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_FUNCTIONAL_COMPARISONS_HPP_INCLUDED
#define NANORANGE_DETAIL_FUNCTIONAL_COMPARISONS_HPP_INCLUDED
// nanorange/detail/concepts/comparison.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_CONCEPTS_COMPARISON_HPP_INCLUDED
#define NANORANGE_DETAIL_CONCEPTS_COMPARISON_HPP_INCLUDED
// nanorange/detail/concepts/core.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_CONCEPTS_CORE_HPP_INCLUDED
#define NANORANGE_DETAIL_CONCEPTS_CORE_HPP_INCLUDED
// nanorange/detail/macros.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_MACROS_HPP_INCLUDED
#define NANORANGE_DETAIL_MACROS_HPP_INCLUDED
#include
#ifdef NANORANGE_NO_DEPRECATION_WARNINGS
#define NANO_DEPRECATED
#define NANO_DEPRECATED_FOR(x)
#else
#define NANO_DEPRECATED [[deprecated]]
#define NANO_DEPRECATED_FOR(x) [[deprecated(x)]]
#endif
#ifdef __has_cpp_attribute
#if __has_cpp_attribute(no_unique_address) >= 201803L
#define NANO_NO_UNIQUE_ADDRESS [[no_unique_address]]
#else
#define NANO_NO_UNIQUE_ADDRESS
#endif // __has_cpp_attribute(no_unique_address)
#else
#define NANO_NO_UNIQUE_ADDRESS
#endif // defined(__has_cpp_attribute)
#define NANO_CONCEPT inline constexpr bool
#define NANO_BEGIN_NAMESPACE \
\
namespace nano \
{ \
\
inline namespace ranges \
{
#define NANO_END_NAMESPACE \
} \
}
#define NANO_INLINE_VAR(type, name) \
inline namespace function_objects { \
inline constexpr type name{}; \
}
#if defined(_LIBCPP_VERSION)
#define NANO_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
#define NANO_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#elif defined(_MSVC_STL_VERSION)
#define NANO_BEGIN_NAMESPACE_STD _STD_BEGIN
#define NANO_END_NAMESPACE_STD _STD_END
#elif defined(_GLIBCXX_DEBUG)
#ifndef NANORANGE_NO_STD_FORWARD_DECLARATIONS
#define NANORANGE_NO_STD_FORWARD_DECLARATIONS
#endif
#else
#define NANO_BEGIN_NAMESPACE_STD namespace std {
#define NANO_END_NAMESPACE_STD }
#endif
#if defined(_MSC_VER)
#define NANO_MSVC_LAMBDA_PIPE_WORKAROUND 1
#endif
#endif
// nanorange/type_traits.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_TYPE_TRAITS_HPP_INCLUDED
#define NANORANGE_TYPE_TRAITS_HPP_INCLUDED
// nanorange/detail/common_reference.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_COMMON_REFERENCE_HPP_INCLUDED
#define NANORANGE_DETAIL_COMMON_REFERENCE_HPP_INCLUDED
// nanorange/detail/type_traits.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_TYPE_TRAITS_HPP_INCLUDED
#define NANORANGE_DETAIL_TYPE_TRAITS_HPP_INCLUDED
#include
NANO_BEGIN_NAMESPACE
template
struct remove_cvref {
using type = std::remove_cv_t>;
};
template
using remove_cvref_t = typename remove_cvref::type;
template
struct type_identity {
using type = T;
};
template
using type_identity_t = typename type_identity::type;
namespace detail {
template
struct conditional {
template
using type = T;
};
template <>
struct conditional {
template
using type = U;
};
template
using conditional_t = typename conditional::template type;
template class AliasT, typename... Args>
auto exists_helper(long) -> std::false_type;
template class AliasT, typename... Args,
typename = AliasT>
auto exists_helper(int) -> std::true_type;
template class AliasT, typename... Args>
inline constexpr bool exists_v = decltype(exists_helper(0))::value;
template
auto test_requires_fn(long) -> std::false_type;
template )>
auto test_requires_fn(int) -> std::true_type;
template
inline constexpr bool requires_ = decltype(test_requires_fn(0))::value;
template
using requires_expr = std::enable_if_t;
template
struct priority_tag : priority_tag {
};
template <>
struct priority_tag<0> {
};
} // namespace detail
NANO_END_NAMESPACE
#endif
NANO_BEGIN_NAMESPACE
template
struct common_type;
namespace detail {
template
struct copy_cv {
using type = U;
};
template
struct copy_cv {
using type = std::add_const_t;
};
template
struct copy_cv {
using type = std::add_volatile_t;
};
template
struct copy_cv {
using type = std::add_cv_t;
};
template
using copy_cv_t = typename copy_cv::type;
template
using cref_t = std::add_lvalue_reference_t>;
// Workaround for "term does not evaluate to a function taking 0 arguments"
// error in MSVC 19.22 (issue #75)
#if defined(_MSC_VER) && _MSC_VER >= 1922
template
struct cond_res {};
template
struct cond_res()()
: std::declval()())>>
{
using type = decltype(false ? std::declval()()
: std::declval()());
};
template
using cond_res_t = typename cond_res::type;
#else
template
using cond_res_t = decltype(false ? std::declval()()
: std::declval()());
#endif
// For some value of "simple"
template ,
typename Y = std::remove_reference_t,
typename = void>
struct common_ref {};
template
using common_ref_t = typename common_ref::type;
template ,
typename Y = std::remove_reference_t,
typename = void>
struct lval_common_ref {};
template
struct lval_common_ref&, copy_cv_t&>>>>
{
using type = cond_res_t&, copy_cv_t&>;
};
template
using lval_common_ref_t = typename lval_common_ref::type;
template
struct common_ref : lval_common_ref {};
template
using rref_cr_helper_t = std::remove_reference_t>&&;
template
struct common_ref> &&
std::is_convertible_v>>>
{
using type = rref_cr_helper_t;
};
template
struct common_ref>>>
{
using type = lval_common_ref_t;
};
template
struct common_ref
: common_ref
{};
template
struct xref { template using type = U; };
template
struct xref {
template
using type = std::add_lvalue_reference_t::template type>;
};
template
struct xref {
template
using type = std::add_rvalue_reference_t::template type>;
};
template
struct xref {
template
using type = std::add_const_t::template type>;
};
template
struct xref {
template
using type = std::add_volatile_t::template type>;
};
template
struct xref {
template
using type = std::add_cv_t::template type>;
};
} // namespace detail
template class TQual,
template class UQual>
struct basic_common_reference {
};
template
struct common_reference;
template
using common_reference_t = typename common_reference::type;
template <>
struct common_reference<> {
};
template
struct common_reference {
using type = T0;
};
namespace detail {
template
inline constexpr bool has_common_ref_v =
exists_v;
template
using basic_common_ref_t =
typename basic_common_reference, remove_cvref_t,
detail::xref::template type, detail::xref::template type>::type;
template
inline constexpr bool has_basic_common_ref_v =
exists_v;
template
inline constexpr bool has_cond_res_v = exists_v;
template
struct binary_common_ref : common_type {
};
template
struct binary_common_ref>>
: common_ref {};
template
struct binary_common_ref &&
!has_common_ref_v>>
{
using type = basic_common_ref_t;
};
template
struct binary_common_ref &&
!has_basic_common_ref_v &&
!has_common_ref_v>>
{
using type = cond_res_t;
};
} // namespace detail
template
struct common_reference : detail::binary_common_ref {
};
namespace detail {
template
struct multiple_common_reference {
};
template
struct multiple_common_reference>, T1, T2,
Rest...>
: common_reference, Rest...> {
};
} // namespace detail
template
struct common_reference
: detail::multiple_common_reference {
};
NANO_END_NAMESPACE
#endif
// nanorange/detail/common_reference.hpp
//
// Copyright (c) 2018 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
#ifndef NANORANGE_DETAIL_COMMON_TYPE_HPP_INCLUDED
#define NANORANGE_DETAIL_COMMON_TYPE_HPP_INCLUDED
NANO_BEGIN_NAMESPACE
template
struct common_type;
template
using common_type_t = typename common_type::type;
namespace detail {
template
constexpr bool same_decayed_v =
std::is_same>::value &&
std::is_same>::value;
template
using ternary_return_t =
std::decay_t() : std::declval())>;
template
struct binary_common_type {};
template
struct binary_common_type>>
: nano::common_type, std::decay_t> {};
template
struct binary_common_type &&
exists_v>> {
using type = ternary_return_t;
};
template
struct binary_common_type &&
!exists_v &&
exists_v, cref_t>>> {
using type = std::decay_t, cref_t>>;
};
}
template <>
struct common_type<> {};
template
struct common_type : common_type {};
template
struct common_type
: detail::binary_common_type {};
namespace detail {
template
struct multiple_common_type {};
template
struct multiple_common_type>, T1, T2, R...>
: common_type, R...> {};
}
template
struct common_type
: detail::multiple_common_type {};
NANO_END_NAMESPACE
#endif
#endif
#include
NANO_BEGIN_NAMESPACE
// [concept.same]
template
NANO_CONCEPT same_as = std::is_same_v;
// [concept.derived]
namespace detail {
struct derived_from_concept {
template
static auto test(long) -> std::false_type;
template
static auto test(int) -> std::enable_if_t<
std::is_base_of_v &&
std::is_convertible_v,
std::true_type>;
};
}
template
NANO_CONCEPT derived_from =
decltype(detail::derived_from_concept::test(0))::value;
// [concept.convertible]
namespace detail {
struct convertible_to_concept {
template
auto requires_(std::add_rvalue_reference_t (&f)())
-> decltype(static_cast(f()));
};
} // namespace detail
template
NANO_CONCEPT convertible_to =
std::is_convertible_v &&
detail::requires_;
// [concept.commonref]
namespace detail {
struct common_reference_with_concept {
template
static auto test(long) -> std::false_type;
template
static auto test(int) -> std::enable_if_t<
same_as, common_reference_t> &&
convertible_to> &&
convertible_to>,
std::true_type>;
};
}
template
NANO_CONCEPT common_reference_with =
decltype(detail::common_reference_with_concept::test(0))::value;
// [concepts.common]
namespace detail {
struct common_with_concept {
template
auto requires_() -> decltype(
static_cast>(std::declval()),
static_cast>(std::declval())
);
template
static auto test(long) -> std::false_type;
template
static auto test(int) -> std::enable_if_t<
same_as, common_type_t> &&
detail::requires_ &&
common_reference_with<
std::add_lvalue_reference_t,
std::add_lvalue_reference_t> &&
common_reference_with<
std::add_lvalue_reference_t>,
common_reference_t<
std::add_lvalue_reference_t,
std::add_lvalue_reference_t>>,
std::true_type>;
};
}
template
NANO_CONCEPT common_with =
decltype(detail::common_with_concept::test(0))::value;
// [concept.arithmetic]
template
NANO_CONCEPT integral = std::is_integral_v;
template
NANO_CONCEPT signed_integral = integral && std::is_signed_v;
template
NANO_CONCEPT unsigned_integral = integral && !signed_integral;
template
NANO_CONCEPT floating_point = std::is_floating_point_v;
// [concept.assignable]
namespace detail {
struct assignable_from_concept {
template
auto requires_(LHS lhs, RHS&& rhs) -> decltype(
requires_expr(rhs)), LHS>>{});
template
static auto test(long) -> std::false_type;
template
static auto test(int) -> std::enable_if_t<
std::is_lvalue_reference_v &&
common_reference_with<
const std::remove_reference_t&,
const std::remove_reference_t&> &&
detail::requires_,
std::true_type>;
};
} // namespace detail
template
NANO_CONCEPT assignable_from =
decltype(detail::assignable_from_concept::test(0))::value;
// [concept.destructible]
template