# std::experimental::ranges::projected

> C++ Atlas: `cppatlas.com/w/cpp/experimental/ranges/iterator/projected` | Source: https://en.cppreference.com/w/cpp/experimental/ranges/iterator/projected | Domain: Technical specifications

The class template projected bundles a Readable type I and a function Proj into a new Readable type whose reference type is the result of applying Proj to the reference type of I.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <experimental/ranges/iterator>

template< Readable I, IndirectRegularUnaryInvocable<I> Proj >
struct projected {
    using value_type =
        std::remove_cv_t<std::remove_reference_t<ranges::indirect_result_of_t<Proj&(I)>>>;
    ranges::indirect_result_of_t<Proj&(I)> operator*() const;
};

template< WeaklyIncrementable I, class Proj >
struct difference_type<projected<I, Proj>> {
    using type = ranges::difference_type_t<I>;
}; // (ranges TS)
```

The class template `projected` bundles a `Readable` type `I` and a function `Proj` into a new `Readable` type whose `reference` type is the result of applying `Proj` to the `reference` type of `I`. It exists solely to ease constraint specification, and so its `operator*()` may not be actually defined.

---
Attribution: content from https://en.cppreference.com/w/cpp/experimental/ranges/iterator/projected (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.