/*!
\page cxx11_support C++11 support in DCMTK
You may compile DCMTK with C++11 support enabled. This may increase performance
since some operations can be performed in a more efficient manner, e.g.
utilizing
move semantics.
To create a C++11 build of DCMTK, you simply need to set the appropriate
compiler-flags while building it (e.g. -std=c++11). This will however not
enable DCMTK to use available C++11 features that aren't implicitly used by
legacy code. This is especially important regarding some C++11 classes DCMTK
directly supports, for example:
\li OFunique_ptr (std::unique_ptr)
\li OFshared_ptr (std::shared_ptr)
\li OFnumeric_limits (std::numeric_limits)
\li OFtuple (std::tuple)
\li OFerror_code (std::error_code)
Since not every compiler supports C++11, legacy implementations for the
respective functionality have been created, which are enabled by default.
If you use C++11 in your project, you may want to use the native C++11 classes
and features instead, so you don't need to convert your objects to use them
with DCMTK. To do so, you need to configure DCMTK to use the C++11 STL, which
is described below.
Enabling DCMTK to use C++11
By enabling DCMTK to use C++11, you gain the following advantages:
\li DCMTK will use available C++11 features instead of its only legacy
implementations. These are probably more efficient and complete.
\li The enabling of C++11 becomes part of DCMTK's configuration, which allows
DCMTK to assist you when checking for API/ABI (in-)compatibility between
C++11 and non C++11 builds.
Trying to include a DCMTK build with C++11 enabled from a non C++11
environment will give you the following error message:
@verbatim
DCMTK was configured to use C++11 features, but your compiler does not or was not configured to provide them.
@endverbatim
To reduce DCMTK's implementation complexity, C++11 shall only be used if your
compiler conforms closely to the C++11 Standard. As far as we know,
this is currently true for the following compilers:
\li GNU C++ Compiler (g++) Version 4.8.1 or later.
\li Clang (clang++) Version 3.3 or later.
To enable the C++11 STL, different steps are necessary on CMake and GNU
Autoconf, see the appropriate section below:
CMake
Request building with C++11 features by setting the option
DCMTK_ENABLE_CXX11 to On, for example via:
@verbatim
cmake ... -DDCMTK_ENABLE_CXX11:BOOL=ON ...
@endverbatim
CMake detects the C++11 compilers and knows how to enable C++11 features on
Clang, GCC and Intel compilers. You can override the assumed compiler flags
(for example to enable C++14 instead) by modifying
DCMTK_CXX11_FLAGS, for example:
@verbatim
cmake ... -DDCMTK_ENABLE_CXX11:BOOL=ON -DDCMTK_CXX11_FLAGS=-std=c++14 ...
@endverbatim
CMake will then perform basic checks to ensure the compiler is configured
correctly and conforms closely enough to C++11 standard. If everything
works CMake will print something like this:
@verbatim
-- Checking whether the compiler supports C++11
-- Checking whether the compiler supports C++11 -- yes
-- Info: C++11 features enabled
@endverbatim
Unsupported Compilers
If our CMake setup does not know how to enable C++11 on your compiler, it will
simply assume that no configuration is required (e.g. for Visual Studio). If
this is not appropriate you have to set DCMTK_CXX11_FLAGS manually
as mentioned above.
If you enable C++11 via DCMTK_ENABLE_CXX11 for an unsupported
compiler, CMake will simply set the flags provided via
DCMTK_CXX11_FLAGS (if any) and still run the C++11 compatibility
test to the compiler conforms closely enough to the C++11 standard for being
able to compile DCMTK. If it doesn't, CMake will give an output similar to
this one:
@verbatim
-- Checking whether the compiler supports C++11
-- Checking whether the compiler supports C++11 -- no
-- Info: C++11 features disabled
@endverbatim
At this point you will not be able to enable C++11 features for the given
compiler, since building DCMTK would fail if you did. If you are sure that
your compiler supports C++11, you should try setting different flags as
DCMTK_CXX11_FLAGS.
GNU Autoconf
Our GNU Autoconf setup understands the switches \--enable-cxx11,
and \--disable-cxx11 that may be used to configure DCMTK to use
C++11 features. If you run
@verbatim
configure --enable-cxx11
@endverbatim
our Autoconf script will try to determine the required compiler flags for
enabling C++11 features (if any) and perform configuration tests to ensure
the compiler conforms closely enough to the C++11 standard. If everything
works it will give you an output similar to this one:
@verbatim
checking whether to enable C++11 support...
checking whether c++ supports C++11 features by default... no
checking whether c++ supports C++11 features with -std=c++11... yes
checking whether to enable C++11 support... yes
@endverbatim
Otherwise, it will still disable C++11 features with an output like this:
@verbatim
checking whether to enable C++11 support...
checking whether c++ supports C++11 features by default... no
checking whether c++ supports C++11 features with -std=c++11... no
checking whether to enable C++11 support... no
@endverbatim
*/