diff --git a/.gitignore b/.gitignore index 54c9275f..8caedc19 100644 --- a/.gitignore +++ b/.gitignore @@ -397,3 +397,6 @@ test/syntax_check/bgcc test/syntax_check/bclang test/vs2022/Debug Clang C++20 test/vs2022/Debug MSVC C++20 - Forve C++03 - No virtual messages +test/reflog.txt +test/etl_error_handler/assert_function/build-make +test/syntax_check/bgcc diff --git a/include/etl/chrono.h b/include/etl/chrono.h new file mode 100644 index 00000000..1e294377 --- /dev/null +++ b/include/etl/chrono.h @@ -0,0 +1,92 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2023 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef ETL_CHRONO_INCLUDED +#define ETL_CHRONO_INCLUDED + +#define ETL_IN_CHRONO_H + +#include "platform.h" + +#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST) + #error NOT SUPPORTED FOR C++03 OR BELOW +#endif + +#if ETL_USING_CPP11 + +#include "type_traits.h" +#include "integral_limits.h" +#include "string_view.h" +#include "hash.h" + +#include +#include + +namespace etl +{ + namespace chrono + { + template + struct treat_as_floating_point : etl::is_floating_point + { + }; + +#if ETL_USING_CPP17 + template + constexpr bool treat_as_floating_point_v = treat_as_floating_point::value; +#endif + } + + // Use the same type as defined in time.h. + using time_t = ::time_t; +} + +#include "private/chrono/last_spec.h" +#include "private/chrono/duration.h" +#include "private/chrono/time_point.h" +#include "private/chrono/clocks.h" +#include "private/chrono/day.h" +#include "private/chrono/weekday.h" +#include "private/chrono/month.h" +#include "private/chrono/month_day.h" +#include "private/chrono/month_weekday.h" +#include "private/chrono/year.h" +#include "private/chrono/year_month.h" +#include "private/chrono/year_month_day.h" +#include "private/chrono/year_month_weekday.h" +#include "private/chrono/hh_mm_ss.h" +#include "private/chrono/operators.h" +#include "private/chrono/time_zone.h" + +#endif + +#undef ETL_IN_CHRONO_H + +#endif diff --git a/include/etl/gcd.h b/include/etl/gcd.h index aea495e5..77df935c 100644 --- a/include/etl/gcd.h +++ b/include/etl/gcd.h @@ -37,6 +37,22 @@ SOFTWARE. namespace etl { + //*************************************************************************** + // Greatest Common Divisor. + // Compile time. + //*************************************************************************** + template + struct gcd_const + { + static ETL_CONSTANT intmax_t value = gcd_const::value; + }; + + template + struct gcd_const + { + static ETL_CONSTANT intmax_t value = A; + }; + //*************************************************************************** // Greatest Common Divisor. // For unsigned types. diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 35e5c8ee..6842eb06 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -2448,6 +2448,21 @@ typedef integral_constant true_type; template inline constexpr size_t count_of_v = etl::count_of::value; #endif + +#if ETL_USING_CPP11 + //********************************************* + /// is_specialization + template class Template> + struct is_specialization : etl::false_type {}; + + template