Quantcast
Channel: Bartek's coding blog
Viewing all articles
Browse latest Browse all 325

Increased Complexity of C++20 Range Algorithms Declarations - Is It Worth?

$
0
0

With the addition of Ranges and Concepts in C++20, our good old algorithm interfaces got super long “rangified” versions. For example, copy is now 4 lines long… and it’s just the declaration!

template<ranges::input_range R, std::weakly_incrementable O>
requires std::indirectly_copyable<ranges::iterator_t<R>, O>
constexpr ranges::copy_result<ranges::borrowed_iterator_t<R>, O>
copy(R&& r, O result);

How to decipher such a long declaration? What benefits do we get instead? Is it worth it? Let’s find out.

Read more...

Viewing all articles
Browse latest Browse all 325

Trending Articles