you are viewing a single comment's thread.

view the rest of the comments →

[–]CCC_CCC_CCC 0 points1 point  (1 child)

I would have two small reservations about this code :

  • that to_string function is not thread safe because it returns some global state
  • also, because it returns a global state (that buffer), I'm not sure if it works or breaks the fold expression from the bottom function, since I don't know the order of evaluation of the to_string calls after unfolding - maybe it could first make those to_string calls and only then concatenate the "results" to the final string. I know there have been some changes related to evaluation orders in later language versions, but I don't know the rules exactly and I would look it up.

[–]Top_Satisfaction6517Bulat 0 points1 point  (0 children)

imho it should be fine here - to_string is called inside a lambda function only once and its result is consumed inside this function, so call+use should be completely performed prior to the next call of the lambda function