JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
std::ranges Namespace Reference

Variables

template<typename SeqType>
constexpr bool enable_borrowed_range< jh::ranges::range_adaptor< SeqType > >
 Legal specialization of std::ranges::enable_borrowed_range.
template<typename R, typename F>
constexpr bool enable_borrowed_range< jh::ranges::vis_transform_view< R, F > >
 Legal specialization of std::ranges::enable_borrowed_range.
template<typename... Views>
constexpr bool enable_borrowed_range< jh::ranges::zip_view< Views... > >
 Legal specialization of std::ranges::enable_borrowed_range.

Variable Documentation

◆ enable_borrowed_range< jh::ranges::range_adaptor< SeqType > >

template<typename SeqType>
bool std::ranges::enable_borrowed_range< jh::ranges::range_adaptor< SeqType > >
inlineconstexpr
Initial value:
=
std::is_lvalue_reference_v<SeqType>

Legal specialization of std::ranges::enable_borrowed_range.

This specialization is explicitly permitted by the C++ standard. User code may provide template specializations for certain customization points declared under the std::ranges namespace, including std::ranges::enable_borrowed_range, to indicate that a custom range type models the borrowed-range property.

About Clang-Tidy false positives

Static analyzers such as Clang-Tidy may emit a warning: "Modification of 'std' namespace can result in undefined behavior". This warning is triggered because Clang-Tidy heuristically treats any declaration inside a user-written namespace std block as a modification of the standard namespace, without recognizing that nested namespaces like std::ranges define a separate, standards-sanctioned customization domain.

Concretely:

  • Specializations such as std::tuple_element<> are recognized by Clang-Tidy as explicitly allowed and thus do not trigger the warning.
  • Specializations inside nested subnamespaces (e.g. std::ranges::enable_borrowed_range<T>) are equally legal under the standard, but Clang-Tidy does not check the whitelist at that depth and therefore incorrectly flags them as potential UB.

This is a false positive — the specialization is fully standard-compliant and does not constitute undefined behavior.

See also
std::ranges::borrowed_range

◆ enable_borrowed_range< jh::ranges::vis_transform_view< R, F > >

template<typename R, typename F>
bool std::ranges::enable_borrowed_range< jh::ranges::vis_transform_view< R, F > >
inlineconstexpr
Initial value:
=
std::is_lvalue_reference_v<R> || std::ranges::borrowed_range<R>

Legal specialization of std::ranges::enable_borrowed_range.

This specialization is explicitly permitted by the C++ standard. User code may provide template specializations for certain customization points declared under the std::ranges namespace, including std::ranges::enable_borrowed_range, to indicate that a custom range type models the borrowed-range property.

About Clang-Tidy false positives

Static analyzers such as Clang-Tidy may emit a warning: "Modification of 'std' namespace can result in undefined behavior". This warning is triggered because Clang-Tidy heuristically treats any declaration inside a user-written namespace std block as a modification of the standard namespace, without recognizing that nested namespaces like std::ranges define a separate, standards-sanctioned customization domain.

Concretely:

  • Specializations such as std::tuple_element<> are recognized by Clang-Tidy as explicitly allowed and thus do not trigger the warning.
  • Specializations inside nested subnamespaces (e.g. std::ranges::enable_borrowed_range<T>) are equally legal under the standard, but Clang-Tidy does not check the whitelist at that depth and therefore incorrectly flags them as potential UB.

This is a false positive — the specialization is fully standard-compliant and does not constitute undefined behavior.

See also
std::ranges::borrowed_range

◆ enable_borrowed_range< jh::ranges::zip_view< Views... > >

template<typename... Views>
bool std::ranges::enable_borrowed_range< jh::ranges::zip_view< Views... > >
inlineconstexpr
Initial value:
=
(std::ranges::borrowed_range<Views> && ...)

Legal specialization of std::ranges::enable_borrowed_range.

This specialization is explicitly permitted by the C++ standard. User code may provide template specializations for certain customization points declared under the std::ranges namespace, including std::ranges::enable_borrowed_range, to indicate that a custom range type models the borrowed-range property.

About Clang-Tidy false positives

Static analyzers such as Clang-Tidy may emit a warning: "Modification of 'std' namespace can result in undefined behavior". This warning is triggered because Clang-Tidy heuristically treats any declaration inside a user-written namespace std block as a modification of the standard namespace, without recognizing that nested namespaces like std::ranges define a separate, standards-sanctioned customization domain.

Concretely:

  • Specializations such as std::tuple_element<> are recognized by Clang-Tidy as explicitly allowed and thus do not trigger the warning.
  • Specializations inside nested subnamespaces (e.g. std::ranges::enable_borrowed_range<T>) are equally legal under the standard, but Clang-Tidy does not check the whitelist at that depth and therefore incorrectly flags them as potential UB.

This is a false positive — the specialization is fully standard-compliant and does not constitute undefined behavior.

See also
std::ranges::borrowed_range