Disable etl::begin(), etl::end() and etl::size() for ETL_NO_STL

This commit is contained in:
John Wellbelove 2021-10-20 13:34:44 +01:00
parent 4766e3190e
commit f3bf0dc7fe
45 changed files with 346 additions and 350 deletions

View File

@ -41,7 +41,6 @@ SOFTWARE.
#include "platform.h"
#include "type_traits.h"
#include "container.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"

View File

@ -36,7 +36,6 @@ SOFTWARE.
#include "error_handler.h"
#include "exception.h"
#include "hash.h"
#include "container.h"
#include "parameter_type.h"
#include "algorithm.h"

View File

@ -41,7 +41,6 @@ SOFTWARE.
#include "iterator.h"
#include "functional.h"
#include "char_traits.h"
#include "container.h"
#include "alignment.h"
#include "array.h"
#include "algorithm.h"

View File

@ -320,10 +320,6 @@ namespace etl
template <typename T>
size_t available() const
{
size_t cap = capacity();
size_t size_b = size_bytes();
size_t size_of_T = sizeof(T);
return (capacity() - size_bytes()) / sizeof(T);
}

View File

@ -36,248 +36,5 @@ SOFTWARE.
#include "platform.h"
#include "iterator.h"
///\defgroup container container
///\ingroup utilities
namespace etl
{
//*****************************************************************************
/// Get the 'begin' iterator.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::iterator begin(TContainer& container)
{
return container.begin();
}
//*****************************************************************************
/// Get the 'begin' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator begin(const TContainer& container)
{
return container.begin();
}
//*****************************************************************************
/// Get the 'begin' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator cbegin(const TContainer& container)
{
return container.cbegin();
}
//*****************************************************************************
/// Get the 'begin' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::reverse_iterator rbegin(const TContainer& container)
{
return container.rbegin();
}
//*****************************************************************************
/// Get the 'begin' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::reverse_iterator crbegin(const TContainer& container)
{
return container.crbegin();
}
//*****************************************************************************
/// Get the 'end' iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::iterator end(TContainer& container)
{
return container.end();
}
//*****************************************************************************
/// Get the 'end' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator end(const TContainer& container)
{
return container.end();
}
//*****************************************************************************
/// Get the 'end' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator cend(const TContainer& container)
{
return container.cend();
}
//*****************************************************************************
/// Get the 'end' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator rend(const TContainer& container)
{
return container.rend();
}
//*****************************************************************************
/// Get the 'end' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::reverse_iterator crend(const TContainer& container)
{
return container.crend();
}
//*****************************************************************************
/// Get the 'begin' pointer for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR TValue* begin(TValue(&data)[ARRAY_SIZE])
{
return &data[0];
}
//*****************************************************************************
/// Get the 'begin' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* begin(const TValue(&data)[ARRAY_SIZE])
{
return &data[0];
}
//*****************************************************************************
/// Get the 'begin' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* cbegin(const TValue(&data)[ARRAY_SIZE])
{
return &data[0];
}
//*****************************************************************************
/// Get the 'begin' reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_OR_STD::reverse_iterator<TValue*> rbegin(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<TValue*>(&data[ARRAY_SIZE]);
}
//*****************************************************************************
/// Get the 'begin' const reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<const TValue*> crbegin(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<const TValue*>(&data[ARRAY_SIZE]);
}
//*****************************************************************************
/// Get the 'end' iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR TValue* end(TValue(&data)[ARRAY_SIZE])
{
return &data[ARRAY_SIZE];
}
//*****************************************************************************
/// Get the 'end' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* end(const TValue(&data)[ARRAY_SIZE])
{
return &data[ARRAY_SIZE];
}
//*****************************************************************************
/// Get the 'end' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* cend(const TValue(&data)[ARRAY_SIZE])
{
return &data[ARRAY_SIZE];
}
//*****************************************************************************
/// Get the 'end' reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<TValue*> rend(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<TValue*>(&data[0]);
}
//*****************************************************************************
/// Get the 'end' const reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<const TValue*> crend(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<const TValue*>(&data[0]);
}
///**************************************************************************
/// Get the size of a container.
/// Expects the container to have defined 'size_type'.
///\ingroup container
///**************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::size_type size(const TContainer& container)
{
return container.size();
}
///**************************************************************************
/// Get the size of an array in elements at run time, or compile time if C++11 or above.
///\ingroup container
///**************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR size_t size(TValue(&)[ARRAY_SIZE])
{
return ARRAY_SIZE;
}
///**************************************************************************
/// Get the size of an array in elements at compile time for C++03
///\code
/// sizeof(array_size(array))
///\endcode
///\ingroup container
///**************************************************************************
template <typename T, const size_t ARRAY_SIZE>
char(&array_size(T(&array)[ARRAY_SIZE]))[ARRAY_SIZE];
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP)
#define ETL_ARRAY_SIZE(a) (etl::size(a))
#else
#define ETL_ARRAY_SIZE(a) sizeof(etl::array_size(a))
#endif
#endif

View File

@ -38,7 +38,6 @@ SOFTWARE.
#include "algorithm.h"
#include "iterator.h"
#include "utility.h"
#include "container.h"
#include "memory.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -39,7 +39,6 @@ SOFTWARE.
#include "functional.h"
#include "utility.h"
#include "pool.h"
#include "container.h"
#include "exception.h"
#include "error_handler.h"
#include "debug_count.h"

View File

@ -686,7 +686,244 @@ namespace etl
{
static ETL_CONSTANT bool value = etl::is_random_access_iterator<T>::value;
};
#if ETL_NOT_USING_STL || ETL_CPP11_NOT_SUPPORTED
//*****************************************************************************
/// Get the 'begin' iterator.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::iterator begin(TContainer& container)
{
return container.begin();
}
//*****************************************************************************
/// Get the 'begin' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator begin(const TContainer& container)
{
return container.begin();
}
//*****************************************************************************
/// Get the 'begin' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator cbegin(const TContainer& container)
{
return container.cbegin();
}
//*****************************************************************************
/// Get the 'begin' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::reverse_iterator rbegin(const TContainer& container)
{
return container.rbegin();
}
//*****************************************************************************
/// Get the 'begin' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::reverse_iterator crbegin(const TContainer& container)
{
return container.crbegin();
}
//*****************************************************************************
/// Get the 'end' iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::iterator end(TContainer& container)
{
return container.end();
}
//*****************************************************************************
/// Get the 'end' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator end(const TContainer& container)
{
return container.end();
}
//*****************************************************************************
/// Get the 'end' const_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator cend(const TContainer& container)
{
return container.cend();
}
//*****************************************************************************
/// Get the 'end' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::const_iterator rend(const TContainer& container)
{
return container.rend();
}
//*****************************************************************************
/// Get the 'end' reverse_iterator for a container.
///\ingroup container
//*****************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::reverse_iterator crend(const TContainer& container)
{
return container.crend();
}
//*****************************************************************************
/// Get the 'begin' pointer for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR TValue* begin(TValue(&data)[ARRAY_SIZE])
{
return &data[0];
}
//*****************************************************************************
/// Get the 'begin' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* begin(const TValue(&data)[ARRAY_SIZE])
{
return &data[0];
}
//*****************************************************************************
/// Get the 'begin' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* cbegin(const TValue(&data)[ARRAY_SIZE])
{
return &data[0];
}
//*****************************************************************************
/// Get the 'begin' reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_OR_STD::reverse_iterator<TValue*> rbegin(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<TValue*>(&data[ARRAY_SIZE]);
}
//*****************************************************************************
/// Get the 'begin' const reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<const TValue*> crbegin(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<const TValue*>(&data[ARRAY_SIZE]);
}
//*****************************************************************************
/// Get the 'end' iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR TValue* end(TValue(&data)[ARRAY_SIZE])
{
return &data[ARRAY_SIZE];
}
//*****************************************************************************
/// Get the 'end' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* end(const TValue(&data)[ARRAY_SIZE])
{
return &data[ARRAY_SIZE];
}
//*****************************************************************************
/// Get the 'end' const iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR const TValue* cend(const TValue(&data)[ARRAY_SIZE])
{
return &data[ARRAY_SIZE];
}
//*****************************************************************************
/// Get the 'end' reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<TValue*> rend(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<TValue*>(&data[0]);
}
//*****************************************************************************
/// Get the 'end' const reverse_iterator for an array.
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<const TValue*> crend(const TValue(&data)[ARRAY_SIZE])
{
return ETL_OR_STD::reverse_iterator<const TValue*>(&data[0]);
}
#endif
#if ETL_NOT_USING_STL || ETL_CPP17_NOT_SUPPORTED
///**************************************************************************
/// Get the size of a container.
/// Expects the container to have defined 'size_type'.
///\ingroup container
///**************************************************************************
template<typename TContainer>
ETL_CONSTEXPR typename TContainer::size_type size(const TContainer& container)
{
return container.size();
}
///**************************************************************************
/// Get the size of an array in elements at run time, or compile time if C++11 or above.
///\ingroup container
///**************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR size_t size(TValue(&)[ARRAY_SIZE])
{
return ARRAY_SIZE;
}
#endif
///**************************************************************************
/// Get the size of an array in elements at compile time for C++03
///\code
/// sizeof(array_size(array))
///\endcode
///\ingroup container
///**************************************************************************
template <typename T, const size_t ARRAY_SIZE>
char(&array_size(T(&array)[ARRAY_SIZE]))[ARRAY_SIZE];
}
#define ETL_ARRAY_SIZE(a) sizeof(etl::array_size(a))
#endif

View File

@ -37,7 +37,6 @@ SOFTWARE.
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -37,7 +37,6 @@ SOFTWARE.
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -37,7 +37,6 @@ SOFTWARE.
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -38,7 +38,6 @@ SOFTWARE.
#include "iterator.h"
#include "functional.h"
#include "parameter_type.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -38,7 +38,7 @@ SOFTWARE.
#include "type_traits.h"
#include "ihash.h"
#include "array.h"
#include "container.h"
#include "iterator.h"
ETL_STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type");

View File

@ -38,7 +38,7 @@ SOFTWARE.
#include "algorithm.h"
#include "utility.h"
#include "functional.h"
#include "container.h"
#include "iterator.h"
#include "vector.h"
#include "type_traits.h"
#include "parameter_type.h"

View File

@ -32,6 +32,7 @@ SOFTWARE.
#define ETL_CHOOSE_NAMESPACE_INCLUDED
#undef ETL_OR_STD
#undef ETL_OR_STD11
#if ETL_NOT_USING_STL && !defined(ETL_IN_UNIT_TEST)
// If we're not using the STL and we are not unit testing, then use the ETL's definitions under the etl namespace
@ -41,4 +42,12 @@ SOFTWARE.
#define ETL_OR_STD std
#endif
#if (ETL_NOT_USING_STL && !defined(ETL_IN_UNIT_TEST)) || ETL_CPP11_NOT_SUPPORTED
// If we're not using the STL and we are not unit testing or C++11 is not supported, then use the ETL's definitions under the etl namespace
#define ETL_OR_STD11 etl
#else
// We will use the STL's definitions under the std namespace
#define ETL_OR_STD11 std
#endif
#endif

View File

@ -46,6 +46,10 @@ SOFTWARE.
#include "../iterator.h"
#include "../limits.h"
#if ETL_USING_STL && ETL_CPP11_SUPPORTED
#include <iterator> // For std::begin, std::end and std::size
#endif
namespace etl
{
namespace private_to_string
@ -107,11 +111,11 @@ namespace etl
{
if (value)
{
str.insert(str.end(), etl::begin(t), etl::end(t));
str.insert(str.end(), ETL_OR_STD11::begin(t), ETL_OR_STD11::end(t));
}
else
{
str.insert(str.end(), etl::begin(f), etl::end(f));
str.insert(str.end(), ETL_OR_STD11::begin(f), ETL_OR_STD11::end(f));
}
}
else
@ -228,11 +232,11 @@ namespace etl
if (not_a_number)
{
str.insert(str.end(), etl::begin(n), etl::end(n));
str.insert(str.end(), ETL_OR_STD11::begin(n), ETL_OR_STD11::end(n));
}
else if (infinity)
{
str.insert(str.end(), etl::begin(i), etl::end(i));
str.insert(str.end(), ETL_OR_STD11::begin(i), ETL_OR_STD11::end(i));
}
}

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include <stdint.h>
#include "platform.h"
#include "container.h"
#include "iterator.h"
#include "alignment.h"
#include "array.h"
#include "exception.h"

View File

@ -34,7 +34,6 @@ SOFTWARE.
#include <stddef.h>
#include "platform.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "platform.h"
#include "algorithm.h"
#include "utility.h"
#include "container.h"
#include "iterator.h"
#include "alignment.h"
#include "array.h"
#include "exception.h"

View File

@ -38,7 +38,6 @@ SOFTWARE.
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
#include "array.h"
#include "intrusive_forward_list.h"

View File

@ -38,7 +38,6 @@ SOFTWARE.
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
#include "vector.h"
#include "intrusive_forward_list.h"

View File

@ -38,7 +38,6 @@ SOFTWARE.
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
#include "vector.h"
#include "intrusive_forward_list.h"

View File

@ -38,7 +38,6 @@ SOFTWARE.
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
#include "vector.h"
#include "intrusive_forward_list.h"

View File

@ -42,7 +42,6 @@ SOFTWARE.
#include "type_traits.h"
#include "error_handler.h"
#include "memory.h"
#include "container.h"
#include "alignment.h"
#include "array.h"
#include "exception.h"

View File

@ -468,5 +468,5 @@ fi
{ echo ""
echo "-----------------------------------------------"
echo " Completed"
echo " All Checks Completed OK"
echo "-----------------------------------------------"; } | tee -a ../log.txt

View File

@ -174,5 +174,5 @@ else
fi
echo ""
echo "-----------------------------------------------" | tee -a log.txt
echo " Tests Completed" | tee -a log.txt
echo " All Tests Completed OK" | tee -a log.txt
echo "-----------------------------------------------" | tee -a log.txt

View File

@ -274,7 +274,7 @@ namespace
int* p1 = std::is_sorted_until(std::begin(data), std::end(data), std::greater<int>());
int* p2 = etl::is_sorted_until(std::begin(data), std::end(data), std::greater<int>());
CHECK_EQUAL(std::distance(etl::begin(data), p1), std::distance(std::begin(data), p2));
CHECK_EQUAL(std::distance(std::begin(data), p1), std::distance(std::begin(data), p2));
}
//*************************************************************************
@ -1601,7 +1601,7 @@ namespace
etl::transform_s(std::begin(input),
std::end(input),
std::begin(output),
std::begin(output) + (etl::size(output) / 2),
std::begin(output) + (std::size(output) / 2),
std::bind(std::multiplies<int>(), std::placeholders::_1, 2));
bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare));
@ -1610,7 +1610,7 @@ namespace
std::fill(std::begin(output), std::end(output), 0);
etl::transform_s(std::begin(input),
std::begin(input) + (etl::size(input) / 2),
std::begin(input) + (std::size(input) / 2),
std::begin(output),
std::end(output),
std::bind(std::multiplies<int>(), std::placeholders::_1, 2));

View File

@ -32,6 +32,8 @@ SOFTWARE.
#include <list>
#if ETL_NOT_USING_STL
namespace
{
SUITE(test_container)
@ -145,3 +147,5 @@ namespace
}
};
}
#endif

View File

@ -341,7 +341,7 @@ namespace
CHECK(motorControl.is_producer());
CHECK(motorControl.is_consumer());
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();
@ -480,7 +480,7 @@ namespace
{
etl::null_message_router nmr;
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();
@ -529,7 +529,7 @@ namespace
{
etl::null_message_router nmr;
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();

View File

@ -424,9 +424,9 @@ namespace
CHECK(motorControl.is_producer());
CHECK(motorControl.is_consumer());
running.set_child_states(childStates, etl::size(childStates));
running.set_child_states(childStates, std::size(childStates));
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();
@ -597,7 +597,7 @@ namespace
{
etl::null_message_router nmr;
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();
@ -650,7 +650,7 @@ namespace
{
etl::null_message_router nmr;
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();
@ -704,7 +704,7 @@ namespace
{
etl::null_message_router nmr;
motorControl.Initialise(stateList, etl::size(stateList));
motorControl.Initialise(stateList, std::size(stateList));
motorControl.reset();
motorControl.ClearStatistics();

View File

@ -152,12 +152,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer)
{
Text text(array_text, etl::size(array_text));
Text text(array_text, std::size(array_text));
CHECK_EQUAL(0U, text.size());
CHECK(text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() == text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
@ -167,12 +167,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text)
{
Text text(array_text, array_text, etl::size(array_text));
Text text(array_text, array_text, std::size(array_text));
CHECK_EQUAL(text.size(), etl::strlen(array_text));
CHECK(!text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() != text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());

View File

@ -152,12 +152,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer)
{
Text text(array_text, etl::size(array_text));
Text text(array_text, std::size(array_text));
CHECK_EQUAL(0U, text.size());
CHECK(text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() == text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
@ -167,12 +167,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text)
{
Text text(array_text, array_text, etl::size(array_text));
Text text(array_text, array_text, std::size(array_text));
CHECK_EQUAL(text.size(), etl::strlen(array_text));
CHECK(!text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() != text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());

View File

@ -152,12 +152,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer)
{
Text text(array_text, etl::size(array_text));
Text text(array_text, std::size(array_text));
CHECK_EQUAL(0U, text.size());
CHECK(text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() == text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
@ -167,12 +167,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text)
{
Text text(array_text, array_text, etl::size(array_text));
Text text(array_text, array_text, std::size(array_text));
CHECK_EQUAL(text.size(), etl::strlen(array_text));
CHECK(!text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() != text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());

View File

@ -33,6 +33,8 @@ SOFTWARE.
#include "etl/string_utilities.h"
#include "etl/vector.h"
#include <string>
#undef STR
#define STR(x) x
@ -910,7 +912,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -930,7 +932,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -950,7 +952,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -970,7 +972,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -35,6 +35,8 @@ SOFTWARE.
#include "etl/string_utilities.h"
#include <string>
#undef STR
#define STR(x) x
@ -909,7 +911,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +931,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +951,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +971,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -909,7 +909,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +929,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +949,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +969,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -909,7 +909,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +929,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +949,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +969,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -909,7 +909,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +929,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +949,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +969,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -909,7 +909,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +929,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +949,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +969,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -909,7 +909,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +929,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +949,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +969,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -909,7 +909,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -929,7 +929,7 @@ namespace
{ STR(':'), STR('_') }
};
etl::replace_characters(text, etl::begin(lookup), etl::end(lookup));
etl::replace_characters(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -949,7 +949,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}
@ -969,7 +969,7 @@ namespace
{ STR(":"), STR(".txt") }
};
etl::replace_strings(text, etl::begin(lookup), etl::end(lookup));
etl::replace_strings(text, ETL_OR_STD11::begin(lookup), ETL_OR_STD11::end(lookup));
CHECK(expected == text);
}

View File

@ -152,12 +152,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer)
{
Text text(array_text, etl::size(array_text));
Text text(array_text, std::size(array_text));
CHECK_EQUAL(0U, text.size());
CHECK(text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() == text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
@ -167,12 +167,12 @@ namespace
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor_use_array_buffer_text)
{
Text text(array_text, array_text, etl::size(array_text));
Text text(array_text, array_text, std::size(array_text));
CHECK_EQUAL(text.size(), etl::strlen(array_text));
CHECK(!text.empty());
CHECK_EQUAL(etl::size(array_text) - 1, text.capacity());
CHECK_EQUAL(etl::size(array_text) - 1, text.max_size());
CHECK_EQUAL(std::size(array_text) - 1, text.capacity());
CHECK_EQUAL(std::size(array_text) - 1, text.max_size());
CHECK(text.begin() != text.end());
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());

View File

@ -181,7 +181,7 @@ namespace
common.Clear();
s.add_task_list(taskList, etl::size(taskList));
s.add_task_list(taskList, std::size(taskList));
CHECK(task1.task_added);
CHECK(task2.task_added);
@ -204,7 +204,7 @@ namespace
s.set_idle_callback(common.idle_callback);
s.set_watchdog_callback(common.watchdog_callback);
s.add_task_list(taskList, etl::size(taskList));
s.add_task_list(taskList, std::size(taskList));
s.start(); // If 'start' returns then the idle callback was sucessfully called.
WorkList_t expected = { "T3W1", "T2W1", "T1W1", "T3W2", "T2W2", "T1W2", "T3W3", "T2W3", "T1W3", "T2W4" };
@ -229,7 +229,7 @@ namespace
s.set_idle_callback(common.idle_callback);
s.set_watchdog_callback(common.watchdog_callback);
s.add_task_list(taskList, etl::size(taskList));
s.add_task_list(taskList, std::size(taskList));
s.start(); // If 'start' returns then the idle callback was sucessfully called.
WorkList_t expected = { "T3W1", "T3W2", "T2W1", "T2W2", "T2W3", "T2W4", "T1W1", "T1W2", "T1W3", "T3W3" };
@ -254,7 +254,7 @@ namespace
s.set_idle_callback(common.idle_callback);
s.set_watchdog_callback(common.watchdog_callback);
s.add_task_list(taskList, etl::size(taskList));
s.add_task_list(taskList, std::size(taskList));
s.start(); // If 'start' returns then the idle callback was sucessfully called.
WorkList_t expected = { "T3W1", "T3W2", "T2W1", "T2W2", "T3W3", "T2W3", "T2W4", "T1W1", "T1W2", "T1W3" };
@ -279,7 +279,7 @@ namespace
s.set_idle_callback(common.idle_callback);
s.set_watchdog_callback(common.watchdog_callback);
s.add_task_list(taskList, etl::size(taskList));
s.add_task_list(taskList, std::size(taskList));
s.start(); // If 'start' returns then the idle callback was sucessfully called.
WorkList_t expected = { "T2W1", "T2W2", "T1W1", "T3W1", "T2W3", "T3W2", "T1W2", "T3W3", "T2W4", "T1W3" };

View File

@ -1221,7 +1221,7 @@ namespace
const S raw[6] = { 1, 2, 3, 4, 5, 6 };
etl::vector<S, 10> dest(etl::begin(raw), etl::end(raw));
etl::vector<S, 10> dest(ETL_OR_STD11::begin(raw), ETL_OR_STD11::end(raw));
etl::vector<S, 10> src((size_t) 2, S(8));
dest.insert(dest.begin(), src.begin(), src.end());
@ -1254,7 +1254,7 @@ namespace
const S raw[6] = { 1, 2, 3, 4, 5, 6 };
etl::vector<S, 10> dest(etl::begin(raw), etl::end(raw));
etl::vector<S, 10> dest(ETL_OR_STD11::begin(raw), ETL_OR_STD11::end(raw));
dest.insert(dest.begin(), 2, S(8));
@ -1280,7 +1280,7 @@ namespace
TEST(remove)
{
const int raw[10] = { 1, 8, 2, 7, 7, 7, 4, 5, 10, 9 };
etl::vector<int, 10> data(etl::begin(raw), etl::end(raw));
etl::vector<int, 10> data(ETL_OR_STD11::begin(raw), ETL_OR_STD11::end(raw));
std::array<int, 7> expected = { 1, 8, 2, 4, 5, 10, 9 };
etl::erase(data, 7);
@ -1295,7 +1295,7 @@ namespace
TEST(remove_if)
{
const int raw[10] = { 1, 8, 2, 7, 7, 7, 4, 5, 10, 9 };
etl::vector<int, 10> data(etl::begin(raw), etl::end(raw));
etl::vector<int, 10> data(ETL_OR_STD11::begin(raw), ETL_OR_STD11::end(raw));
std::array<int, 4> expected = { 1, 2, 4, 5 };
etl::erase_if(data, [](int value) { return value >= 7; });

View File

@ -1149,7 +1149,7 @@ namespace
const S raw[6] = { 1, 2, 3, 4, 5, 6 };
etl::vector_ext<S> dest(etl::begin(raw), etl::end(raw), sbuffer1, SIZE);
etl::vector_ext<S> dest(std::begin(raw), std::end(raw), sbuffer1, SIZE);
etl::vector_ext<S> src((size_t) 2, S(8), sbuffer2, SIZE);
dest.insert(dest.begin(), src.begin(), src.end());
@ -1184,7 +1184,7 @@ namespace
const S raw[6] = { 1, 2, 3, 4, 5, 6 };
etl::vector_ext<S> dest(etl::begin(raw), etl::end(raw), sbuffer1, SIZE);
etl::vector_ext<S> dest(ETL_OR_STD11::begin(raw), ETL_OR_STD11::end(raw), sbuffer1, SIZE);
dest.insert(dest.begin(), 2, S(8));