Search code examples
c++boostmove-semanticsstrong-typing

BOOST_STRONG_TYPEDEF and move semantics


From what I can see BOOST_STRONG_TYPEDEF does not support move semantics(no move ctor/assignment).

Is this just an oversight(nobody updated old macro) or is there a more fundamental reason why strong typedefs are limited in this way?


Solution

  • The fundamental reason would be that many boost libraries are still targetting pre-c++11 standard compilers¹, i.e. compilers that do not support move semantics.

    I suppose for some compilers the tricks in Boost Move might be used, but I'm not sure that would be easy to apply transparently to strong typedefs.

    However, I'd always roll my own strong typedef to do the job, as I've suggested fro other reasons, e.g. How do I strongly typedef non-primitive types?


    ¹ Boost Serialization is definitely one of these libraries