Skip to content

Commit

Permalink
GCC 4.x doesn't have std::is_trivially_copyable
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed May 8, 2024
1 parent 31a9460 commit 5256cfc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/test_uuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,24 @@
#include <boost/container_hash/hash.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/current_function.hpp>
#include <boost/config.hpp>
#include <iostream>
#include <type_traits>

// is_trivially_copyable not present in GCC 4.x

#if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000

template<class T> struct is_trivially_copyable: std::integral_constant<bool,
__has_trivial_copy(T) && __has_trivial_assign(T) && __has_trivial_destructor(T)> {};

#else

using std::is_trivially_copyable;

#endif

//

void test_uuid_equal_array(char const * file, int line, char const * function,
boost::uuids::uuid const& lhs, const unsigned char (&rhs)[16])
Expand Down Expand Up @@ -308,8 +325,9 @@ int main()
}

{ // test type properties

BOOST_TEST_EQ(std::is_pod<uuid>::value, true);
BOOST_TEST_EQ(std::is_trivially_copyable<uuid>::value, true);
BOOST_TEST_EQ(::is_trivially_copyable<uuid>::value, true);
BOOST_TEST_EQ(std::is_standard_layout<uuid>::value, true);
}

Expand Down

0 comments on commit 5256cfc

Please sign in to comment.