diff --git a/CMakeLists.txt b/CMakeLists.txt index 0031474..d9abcfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,9 +74,7 @@ install(TARGETS crossguid EXPORT crossguidTargets # Install headers install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" - DESTINATION ${CROSSGUID_INC_INSTALL_DIR} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + DESTINATION ${CROSSGUID_INC_INSTALL_DIR}) # Make cmake config files for all targets install(EXPORT crossguidTargets @@ -85,8 +83,7 @@ install(EXPORT crossguidTargets # Install readme and license install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" "${CMAKE_CURRENT_SOURCE_DIR}/README.md" - DESTINATION ${CROSSGUID_ADDITIONAL_FILES_INSTALL_DIR} - PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) + DESTINATION ${CROSSGUID_ADDITIONAL_FILES_INSTALL_DIR}) if (CROSSGUID_TESTS) add_executable(crossguid-test test/TestMain.cpp test/Test.cpp) diff --git a/include/crossguid/guid.hpp b/include/crossguid/guid.hpp index be1c203..43b0476 100644 --- a/include/crossguid/guid.hpp +++ b/include/crossguid/guid.hpp @@ -53,8 +53,12 @@ class Guid Guid(const unsigned char *bytes); Guid(const std::string &fromString); Guid(); - Guid(const Guid &other); - Guid &operator=(const Guid &other); + + Guid(const Guid &other) = default; + Guid &operator=(const Guid &other) = default; + Guid(Guid &&other) = default; + Guid &operator=(Guid &&other) = default; + bool operator==(const Guid &other) const; bool operator!=(const Guid &other) const; @@ -105,7 +109,7 @@ namespace std // Template specialization for std::swap() -- // See guid.cpp for the function definition template <> - void swap(xg::Guid &guid0, xg::Guid &guid1); + void swap(xg::Guid &guid0, xg::Guid &guid1) noexcept; // Specialization for std::hash -- this implementation // uses std::hash on the stringification of the guid diff --git a/src/guid.cpp b/src/guid.cpp index 9283465..3ce8b48 100644 --- a/src/guid.cpp +++ b/src/guid.cpp @@ -245,23 +245,12 @@ Guid::Guid(const std::string &fromString) Guid::Guid() : _bytes{ {0} } { } -// copy constructor -Guid::Guid(const Guid &other) : _bytes(other._bytes) -{ } - // set all bytes to zero void Guid::zeroify() { std::fill(_bytes.begin(), _bytes.end(), static_cast(0)); } -// overload assignment operator -Guid &Guid::operator=(const Guid &other) -{ - Guid(other).swap(*this); - return *this; -} - // overload equality operator bool Guid::operator==(const Guid &other) const { @@ -408,7 +397,7 @@ END_XG_NAMESPACE namespace std { template <> - void swap(xg::Guid &lhs, xg::Guid &rhs) + void swap(xg::Guid &lhs, xg::Guid &rhs) noexcept { lhs.swap(rhs); }