Class template dangling is a wrapper for an object that refers to another object whose lifetime may have ended. It is used by algorithms that accept rvalue ranges and return iterators.
namespace std { namespace experimental { namespace ranges { inline namespace v1 {
template <CopyConstructible T>
class dangling {
public:
constexpr dangling() requires DefaultConstructible<T>;
constexpr dangling(T t);
constexpr T get_unsafe() const;
private:
T value; // exposition only
};
template <Range R>
using safe_iterator_t =
conditional_t<is_lvalue_reference<R>::value,
iterator_t<R>,
dangling<iterator_t<R>>>;
}}}}
constexpr dangling() requires DefaultConstructible<T>;
Effects: Constructs a dangling, value-initializing value.
Effects: Constructs a dangling, initializing value with t.
constexpr T get_unsafe() const;
Returns: value.