mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-17 09:26:05 +08:00
Merge branch 'pull-request/#905-Add-support-for-type_identity' into development
This commit is contained in:
commit
e159a6b7ff
@ -100,7 +100,7 @@ namespace etl
|
||||
|
||||
//***************************************************************************
|
||||
/// Gets the line for the exception.
|
||||
/// \return const char* to the line.
|
||||
/// \return int as line number.
|
||||
//***************************************************************************
|
||||
ETL_CONSTEXPR
|
||||
numeric_type line_number() const
|
||||
|
||||
@ -2295,6 +2295,17 @@ typedef integral_constant<bool, true> true_type;
|
||||
template <typename T>
|
||||
using signed_type_t = typename signed_type<T>::type;
|
||||
#endif
|
||||
|
||||
//*********************************************
|
||||
// type_identity
|
||||
|
||||
template <typename T>
|
||||
struct type_identity { typedef T type; };
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
template <typename T>
|
||||
using type_identity_t = typename type_identity<T>::type;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper macros
|
||||
|
||||
@ -2288,6 +2288,17 @@ typedef integral_constant<bool, true> true_type;
|
||||
template <typename T>
|
||||
using signed_type_t = typename signed_type<T>::type;
|
||||
#endif
|
||||
|
||||
//*********************************************
|
||||
// type_identity
|
||||
|
||||
template <typename T>
|
||||
struct type_identity { typedef T type; };
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
template <typename T>
|
||||
using type_identity_t = typename type_identity<T>::type;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper macros
|
||||
|
||||
@ -40,7 +40,7 @@ SOFTWARE.
|
||||
|
||||
#define ETL_VERSION_MAJOR 20
|
||||
#define ETL_VERSION_MINOR 38
|
||||
#define ETL_VERSION_PATCH 16
|
||||
#define ETL_VERSION_PATCH 17
|
||||
|
||||
#define ETL_VERSION ETL_STRING(ETL_VERSION_MAJOR) "." ETL_STRING(ETL_VERSION_MINOR) "." ETL_STRING(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_W ETL_WIDE_STRING(ETL_VERSION_MAJOR) L"." ETL_WIDE_STRING(ETL_VERSION_MINOR) L"." ETL_WIDE_STRING(ETL_VERSION_PATCH)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Embedded Template Library",
|
||||
"version": "20.38.16",
|
||||
"version": "20.38.17",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library
|
||||
version=20.38.16
|
||||
version=20.38.17
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
===============================================================================
|
||||
20.38.17
|
||||
|
||||
#895 Removed std algorithm calls from algorithm.h
|
||||
|
||||
===============================================================================
|
||||
20.38.16
|
||||
|
||||
Fixes:
|
||||
|
||||
@ -122,6 +122,13 @@ namespace
|
||||
NotDefaultConstructible(NotDefaultConstructible&&) = delete;
|
||||
NotDefaultConstructible& operator =(NotDefaultConstructible&) = delete;
|
||||
};
|
||||
|
||||
// A function to test etl::type_identity.
|
||||
template <typename T>
|
||||
T type_identity_test_add(T first, typename etl::type_identity<T>::type second)
|
||||
{
|
||||
return first + second;
|
||||
}
|
||||
}
|
||||
|
||||
// Definitions for when the STL and compiler built-ins are not available.
|
||||
@ -1320,4 +1327,10 @@ namespace
|
||||
CHECK_FALSE(bool(etl::is_base_of_all<Base, D1, D2, D3, D4>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_type_identity)
|
||||
{
|
||||
CHECK_CLOSE(type_identity_test_add(1.5f, 2), 3.5f, 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
20.38.16
|
||||
20.38.17
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user