C++03 compatibility changes for type_traits.h

This commit is contained in:
John Wellbelove 2020-05-27 11:57:41 +01:00
parent 16fec7f491
commit f8fbb119f7
10 changed files with 42 additions and 10 deletions

1
.gitignore vendored
View File

@ -256,3 +256,4 @@ build-test-Desktop_x86_windows_msvc2017_pe_32bit-Debug
test/Logs
build-test-Desktop_x86_windows_msvc2019_pe_32bit-Debug
test/vs2019/.vs
Corel Auto-Preserve

BIN
etl-patreon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
etl-social.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -114,6 +114,9 @@ namespace etl
#if ETL_CPP11_SUPPORTED
template <bool B>
using bool_constant = integral_constant<bool, B>;
#else
template <bool B>
struct bool_constant : etl::integral_constant<bool, B> { };
#endif
//***************************************************************************
@ -799,6 +802,9 @@ namespace etl
#if ETL_CPP17_SUPPORTED
template <bool B>
using bool_constant = std::bool_constant<B>;
#else
template <bool B>
struct bool_constant : std::integral_constant<bool, B> { };
#endif
//***************************************************************************

View File

@ -102,6 +102,9 @@ namespace etl
#if ETL_CPP11_SUPPORTED
template <bool B>
using bool_constant = integral_constant<bool, B>;
#else
template <bool B>
struct bool_constant : etl::integral_constant<bool, B> { };
#endif
//***************************************************************************
@ -787,6 +790,9 @@ namespace etl
#if ETL_CPP17_SUPPORTED
template <bool B>
using bool_constant = std::bool_constant<B>;
#else
template <bool B>
struct bool_constant : std::integral_constant<bool, B> { };
#endif
//***************************************************************************

View File

@ -39,7 +39,7 @@ SOFTWARE.
#define ETL_VERSION_MAJOR 18
#define ETL_VERSION_MINOR 3
#define ETL_VERSION_PATCH 0
#define ETL_VERSION_PATCH 1
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "18.3.0",
"version": "18.3.1",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library
version=18.3.0
version=18.3.1
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,7 @@
===============================================================================
18.3.1
C++03 compatibility fix for type_traits.h
===============================================================================
18.3.0
Added etl::parameter_pack to easily extract information about the types in a

View File

@ -737,7 +737,7 @@ namespace
};
//*************************************************************************
TEST(conditional_integral_constant)
TEST(test_conditional_integral_constant)
{
int v1 = etl::conditional_integral_constant<true, int, 1, 2>::value;
int v2 = etl::conditional_integral_constant<false, int, 1, 2>::value;
@ -747,7 +747,7 @@ namespace
}
//*************************************************************************
TEST(size_of)
TEST(test_size_of)
{
CHECK_EQUAL(1, etl::size_of<void>::value);
CHECK_EQUAL(1, etl::size_of<char>::value);
@ -763,7 +763,7 @@ namespace
}
//*************************************************************************
TEST(is_convertible)
TEST(test_is_convertible)
{
CHECK((etl::is_convertible<char, int>::value));
CHECK((etl::is_convertible<int, char>::value));
@ -779,7 +779,7 @@ namespace
}
//*************************************************************************
TEST(add_lvalue_reference)
TEST(test_add_lvalue_reference)
{
CHECK(!std::is_lvalue_reference_v<etl::add_lvalue_reference<void>::type>);
CHECK(std::is_lvalue_reference_v<etl::add_lvalue_reference<int>::type>);
@ -789,7 +789,7 @@ namespace
}
//*************************************************************************
TEST(add_rvalue_reference)
TEST(test_add_rvalue_reference)
{
CHECK(!std::is_rvalue_reference_v<etl::add_rvalue_reference<void>::type>);
CHECK(std::is_rvalue_reference_v<etl::add_rvalue_reference<int>::type>);
@ -799,7 +799,7 @@ namespace
}
//*************************************************************************
TEST(is_lvalue_reference)
TEST(test_is_lvalue_reference)
{
CHECK_EQUAL(std::is_lvalue_reference_v<void>, etl::is_lvalue_reference_v<void>);
CHECK_EQUAL(std::is_lvalue_reference_v<int>, etl::is_lvalue_reference_v<int>);
@ -809,7 +809,7 @@ namespace
}
//*************************************************************************
TEST(is_rvalue_reference)
TEST(test_is_rvalue_reference)
{
CHECK_EQUAL(std::is_rvalue_reference_v<void>, etl::is_rvalue_reference_v<void>);
CHECK_EQUAL(std::is_rvalue_reference_v<int>, etl::is_rvalue_reference_v<int>);
@ -817,4 +817,19 @@ namespace
CHECK_EQUAL(std::is_rvalue_reference_v<int&>, etl::is_rvalue_reference_v<int&>);
CHECK_EQUAL(std::is_rvalue_reference_v<int&&>, etl::is_rvalue_reference_v<int&&>);
}
//*************************************************************************
TEST(test_integral_constants)
{
CHECK_EQUAL(1, (etl::integral_constant<int, 1>::value));
CHECK((std::is_same_v<int, etl::integral_constant<int, 1>::value_type>));
CHECK_EQUAL(false, (etl::bool_constant<false>::value));
CHECK_EQUAL(true, (etl::bool_constant<true>::value));
CHECK((std::is_same_v<bool, etl::bool_constant<true>::value_type>));
CHECK_EQUAL(true, etl::negation_v<etl::bool_constant<false>>);
CHECK_EQUAL(false, etl::negation_v<etl::bool_constant<true>>);
CHECK((std::is_same_v<bool, etl::bool_constant<true>::value_type>));
}
}