-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Hello! Every next call do a copy, how to pass a ref value?
Example:
struct test_t {
std::string v1;
int v2;
};
constexpr std::size_t benchmarkVectorSize{ 1000000 };
std::vector<test_t> vecCpp(benchmarkVectorSize);
srand(0xDEADBEEF);
for (unsigned i = 0; i < benchmarkVectorSize; i++) {
const auto x = rand();
vecCpp[i].v2 = x;
vecCpp[i].v1 = std::to_string(x);
}
boolinq::from(vecCpp).for_each([](test_t a) {
a.v1;
int iii = 02;
});
every for_each make object copy about 2 times
how to aviod this, and how can i change value in for_each ops;
I want this work well:
boolinq::from(vecCpp).for_each([](test_t &a) {
a.v1 = "123"
});
Metadata
Metadata
Assignees
Labels
No labels