brintos

brintos / llvm-project-archived public Read only

0
0
Text · 947 B · 4b05794 Raw
30 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2010 11// Some basic examples of how zip_transform_view might be used in the wild. This is a general12// collection of sample algorithms and functions that try to mock general usage of13// this view.14 15#include <ranges>16 17#include <algorithm>18#include <cassert>19#include <functional>20#include <vector>21 22int main(int, char**) {23  std::vector v1 = {1, 2};24  std::vector v2 = {4, 5, 6};25  auto ztv       = std::views::zip_transform(std::plus(), v1, v2);26  auto expected  = {5, 7};27  assert(std::ranges::equal(ztv, expected));28  return 0;29}30