May 2017
Intermediate to advanced
590 pages
17h 18m
English
To provide multiple versions of a library and let the user decide what version to use, do the following:
The following example shows a library that has two versions that clients can use:
namespace modernlib { #ifndef LIB_VERSION_2 inline namespace version_1 { template<typename T> int test(T value) { return 1; } } #endif #ifdef LIB_VERSION_2 inline namespace version_2 { template<typename T> int test(T value) { return 2; } } #endif }
Read now
Unlock full access