Skip to content

Commit

Permalink
Merge pull request #262 from puji4810/main
Browse files Browse the repository at this point in the history
作业第一次提交
  • Loading branch information
rsp4jack authored Jan 31, 2024
2 parents c0b9ec1 + 4f7ea4c commit 7271099
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/群友提交/第01题/mq日.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <algorithm>
#include <vector>
#include <functional>
#include <iostream>
template<typename T,typename IT>
T& operator |(T&& v,const IT& f)
{
for(auto&& x:v)
{
f(x);
}
return v;
}

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 7271099

Please sign in to comment.