Are there any practical differences between std::function for type with value parameter vs with const reference to value parameter? Consider following code:
auto foo = [] (VeryBigType i) {
};
auto bar = [] (const VeryBigType& i) {
};
std::function<void(VeryBigType)> a;
a = foo;
a = bar;
std::function<void(const VeryBigType&)> b;
b = foo;
b = bar;
This code compiles without issues and works perfeclty well. I know that passing by value vs by ref has performance differences and so foo and bar would behave differently. But are there any differences depending on std::function template type? For example, are there any implementation and/or behaviour and/or performance differences between
std::function<void(VeryBigType)>(bar) vs std::function<void(const VeryBigType&)>(bar) or these constructs are equivalent?