Skip to content

Commit

Permalink
Create 嘻嘻.cpp
Browse files Browse the repository at this point in the history
第一次提交,:)
  • Loading branch information
CrossroadW authored and Mq-b committed Apr 28, 2024
1 parent 455b14a commit 6c790c5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/群友提交/第01题/嘻嘻.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<iostream>
#include<vector>
#include<functional>

using namespace std;

static auto& operator|(vector<int>& in, auto f) {
for (auto& it : in) {
f(it);
}
return in;
}

int main() {
std::vector v{ 1, 2, 3 };
std::function f{ [](const int& i) {std::cout << i << ' '; } };
auto f2 = [](int& i) {i *= i; };
v | f2 | f;
}

0 comments on commit 6c790c5

Please sign in to comment.