I am trying to understand the concept of currying and calling a function which concats three strings but by passing only two strings and using the second argument twice.
Copying strings is expensive. Since std::bind
thinks that the values of the placeholders are only used once, it performs a std::move
on the strings. This is done for each Parameter and as a consequence, either b
or c
is a moved, that means empty string.
You can change that behavior by explicitly saying what you mean, by passing the arguments by const-reference:
string concatthreestrings(string const& a,string const& b,string const& c)
Now, it should work.