I have read the rationale for inline namespaces (explanation), and wonder how they can be used to keep binary compatibility in an existing shared library.
If this is our current library, which is shared with clients and need to be stable:
struct ModelA
{
/* (...) lots of stuff */
};
struct ModelB
{
/* (...) lots of stuff */
};
Can we use inline namespaces to introduce new versions of the structs/classes without breaking the clients (i.e. replace the shared library file only, no recompile neccessary)?
inline namespace mylib
{
inline namespace v1
{
struct ModelA
{
/* (...) lots of stuff */
};
} // end namespace v1
namespace v2
{
struct ModelA
{
/* (...) lots of stuff + newstuff */
};
} // end namespace v2
struct ModelB
{
/* (...) lots of stuff */
};
} // end namespace mylib
If not, will it work without the enclosing namespace mylib?
Aucun commentaire:
Enregistrer un commentaire