プログラミング言語C++標準規格のサンプルコードでビートを刻むMCハマー。
"U Can't Touch This" ( 'ω' و(و♪ ƪ( 'ω' ƪ )♪
template<ranges::constant_range R> void cant_touch_this(R&&); vector<char> hammer = {'m', 'c'}; span<char> beat = hammer; cant_touch_this(views::as_const(beat)); // will not modify the elements of hammerhttps://github.com/cplusplus/draft/commit/32535186bc66b3485194b41d5b2107e15c6bd34a
std::ranges::constant_range
コンセプトやstd::views::as_const
レンジアダプタはC++2b(C++23)標準ライブラリへの追加予定機能。
関連URL