What are differences between std, tr1 and boost (as namespaces and/or libraries)?

后端 未结 4 1225
走了就别回头了
走了就别回头了 2020-12-05 07:08

I initially thought they\'re all the same, but it turned out to be wrong. So can anyone briefly explain the differences between these three? For example:

4条回答
  •  爱一瞬间的悲伤
    2020-12-05 07:32

    You've pretty much got it in your question there. I could just copy/paste your example and answer your question correctly. Only two thing really stand out as needing expansion:

    1) Exactly HOW and why std:: is expanded by tr1. TR1 is "Technical Report 1" and is the first official set of library expansions proposed to the standards committee by one of its subgroups. So it's a little more than just an extension of the standard.

    2) boost::bind actually behaves differently than std::bind, at least on some systems. I don't know if it's by standard on not but in MSVC lambda expressions and std::bind behave very poorly with each other. Maybe some other ways too, I don't recall since I made it policy to use boost::bind rather than std::bind. The return value template parameter seems to often be ignored with std::bind on msvc so that you get errors about there being no return_value::type (or whatever) when you've specified it with std::bind(...). Never bothered to figure out the exact difference in behavior since boost::bind had already made it into our regular vocabulary and we knew how to use it.

提交回复
热议问题