"ScL Feature"/
ScL Feature 0.0.1
C++20 composable proxy wrapper with pluggable executor strategy
Loading...
Searching...
No Matches
ScL Wrapper Cast

Lazy-locking cast utility for wrapper and plain value references. More...

Classes

class  scl::wrapper_caster< Refer >
 Lazy-locking cast proxy for a wrapper or plain value reference. More...

Functions

template<typename Value>
constexpr decltype(auto) scl::wrapper_cast (Value &&v) noexcept
 Pass-through overload for non-wrapper types — returns the reference unchanged.
template<typename Wrapper>
constexpr decltype(auto) scl::wrapper_cast (Wrapper &&w)
 Returns a lazy-locking cast proxy for a wrapper reference.

Detailed Description

Lazy-locking cast utility for wrapper and plain value references.

scl::wrapper_cast() returns a wrapper_caster<Refer> proxy that captures references to every executor in the wrapper chain without acquiring any guard. Guards are activated lazily, only at the moment the proxy is converted to the desired target type.

This allows generic code to cast uniformly through wrapper chains: non-wrapper types are passed through as-is via a no-op overload.

Function Documentation

◆ wrapper_cast() [1/2]

template<typename Value>
decltype(auto) scl::wrapper_cast ( Value && v)
nodiscardconstexprnoexcept

Pass-through overload for non-wrapper types — returns the reference unchanged.

Allows generic code to call wrapper_cast() uniformly on both wrapper and non-wrapper values.

Template Parameters
ValueAny non-wrapper type.
Parameters
vForwarding reference to the value.
Returns
v forwarded as-is (no allocation, no guard).

◆ wrapper_cast() [2/2]

template<typename Wrapper>
decltype(auto) scl::wrapper_cast ( Wrapper && w)
nodiscardconstexpr

Returns a lazy-locking cast proxy for a wrapper reference.

Guards are not acquired at the call site — they are activated lazily when the returned wrapper_caster<Wrapper> is converted to the desired target type.

Template Parameters
WrapperA wrapper specialisation (cv-ref qualifiers are ignored for the concept check but propagated into the proxy).
Parameters
wForwarding reference to the wrapper.
Returns
A wrapper_caster<Wrapper> proxy.