diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-04-24 21:36:05 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-04-25 20:08:47 (GMT) |
commit | d0b70e676e286cfa7fe1b72cafdf5f704e1038d2 (patch) | |
tree | 0447ebcbebaeb6f1425b7cfa1580f8113bccf681 /Help/dev | |
parent | 3cb7048b521395fdc863dacacb85c6f7f28a1bc7 (diff) | |
download | CMake-d0b70e676e286cfa7fe1b72cafdf5f704e1038d2.zip CMake-d0b70e676e286cfa7fe1b72cafdf5f704e1038d2.tar.gz CMake-d0b70e676e286cfa7fe1b72cafdf5f704e1038d2.tar.bz2 |
Help/dev: Document CM_EQ_DELETE and CM_DISABLE_COPY
Diffstat (limited to 'Help/dev')
-rw-r--r-- | Help/dev/source.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 3ac9aca..7e44995 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -34,6 +34,24 @@ need to be handled with care: warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR`` macro instead. +* Use ``CM_EQ_DELETE;`` instead of ``= delete;``. + + Defining functions as *deleted* is not supported in C++98. Using + ``CM_EQ_DELETE`` will delete the functions if the compiler supports it and + give them no implementation otherwise. Calling such a function will lead + to compiler errors if the compiler supports *deleted* functions and linker + errors otherwise. + +* Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable. + + The ``CM_DISABLE_COPY`` macro should be used in the private section of a + class to make sure that attempts to copy or assign an instance of the class + lead to compiler errors even if the compiler does not support *deleted* + functions. As a guideline, all polymorphic classes should be made + non-copyable in order to avoid slicing. Classes that are composed of or + derived from non-copyable classes must also be made non-copyable explicitly + with ``CM_DISABLE_COPY``. + * Use ``size_t`` instead of ``std::size_t``. Various implementations have differing implementation of ``size_t``. |