Embedded Template Library

Overview

Embedded Template Library (ETL)

GitHub release (latest by date) License CI CI CI Codacy Badge

Motivation

C++ is a great language to use for embedded applications and templates are a powerful aspect. The standard library can offer a great deal of well tested functionality, but there are some parts of the standard library that do not fit well with deterministic behaviour and limited resource requirements. These limitations usually preclude the use of dynamically allocated memory and containers with open ended sizes.

What is needed is a template library where the user can declare the size, or maximum size of any object upfront. Most embedded compilers do not currently support the standard beyond C++ 03, therefore excluding the programmer from using the enhanced features of the later library.

This is what the ETL attempts to achieve.

Summary

The ETL is not designed to completely replace the STL, but complement it. Its design objective covers three areas.

  • Create a set of containers where the size or maximum size is determined at compile time. These containers are direct equivalents of those supplied in the STL.
  • Be compatible with C++ 03 but implement as many of the C++ 11 additions as possible.
  • Add other useful components that are not present in the standard library.

The embedded template library has been designed for lower resource embedded applications. It contains a set of containers, algorithms and utilities, some of which emulate parts of the STL. There is no dynamic memory allocation. The library makes no use of the heap. All of the containers have a fixed capacity allowing all memory allocation to be determined at compile time. The library is intended for any compiler that supports C++ 03.

Main features:

  • Cross platform. This library is not specific to any processor type.
  • No dynamic memory allocation
  • No RTTI required
  • Very little use of virtual functions. They are used only when they are absolutely necessary for the required functionality
  • A set of fixed capacity containers. (array, bitset, deque, forward_list, list, queue, stack, vector, map, set, etc.)
  • As the storage for all of the container types is allocated as a contiguous block, they are extremely cache friendly
  • Templated compile time constants
  • Templated design pattern base classes (Visitor, Observer)
  • Reverse engineered C++ 0x11 features (type traits, algorithms, containers etc.)
  • Type-safe enumerations
  • Type-safe typedefs
  • 8, 16, 32 & 64 bit CRC calculations
  • Checksums & hash functions
  • Variants (a type that can store many types in a type-safe interface)
  • Choice of asserts, exceptions, error handler or no checks on errors
  • Many utilities for template support.
  • Easy to read and documented source.
  • Free email support

Any help porting the library to work under different platforms and compilers would be gratefully received. I am especially interested in people who are using Keil, IAR, Green Hills, TI Code Composer etc, bare metal or RTOS, and DSPs.

See (https://www.etlcpp.com) for up-to-date information.

Comments
  • etl outdated on platformio registry

    etl outdated on platformio registry

    ETLCPP has 2 versions on platformio registry: arduino one (which is up-to-date), and non-arduino one. The latter is 19.3.5 and has not been updated for a while. Is it possible to update it? I'm using it for CubeMX project, and seemingly I don't want an arduino version of the library (though I don't exactly know what the differences are).

    opened by positron96 57
  • Support an owning version of delegate

    Support an owning version of delegate

    I think the etl would greatly benefit of an owning version of the delegate class similar to std::function but instead it stores the closure in an internal buffer (being it is on the stack with a user-defined static capacity) instead of heap allocated memory. The internal buffer size could be spezified by a template parameter.

    Some implementations I found are:

    • https://github.com/rigtorp/Function
    • https://github.com/tacticalmelonfarmer/callable
    enhancement 
    opened by humanosc 41
  • How do you actually install this library ?

    How do you actually install this library ?

    Hello !

    I am trying to use this library on PlatformIO IDE, but I'm having no luck. I'm using it with lib_deps = 930 inside platformio.ini.

    I've read here: https://www.etlcpp.com/setup.html and I made etl_profile.h and I put it inside include folder in the project's folder:

    #ifndef __ETL_PROFILE_H__
    #define __ETL_PROFILE_H__
    
    #define ETL_THROW_EXCEPTIONS
    #define ETL_VERBOSE_ERRORS
    #define ETL_CHECK_PUSH_POP
    
    #endif
    

    With:

    #include <etl_profile.h>
    #include <deque.h>
    

    compiling gives me the following error:

    compilation terminated.
    *** [.pioenvs/esp32doit-devkit-v1/lib14e/Embedded Template Library_ID930/crc16.cpp.o] Error 1
    compilation terminated.
    *** [.pioenvs/esp32doit-devkit-v1/lib14e/Embedded Template Library_ID930/binary.cpp.o] Error 1
    In file included from .piolibdeps/Embedded Template Library_ID930/src/c/ecl_timer.c:32:0:
    .piolibdeps/Embedded Template Library_ID930/src/c/ecl_timer.h:34:22: fatal error: ecl_user.h: No such file or directory
    

    Without #include <etl_profile.h> it says:

    compilation terminated.
    *** [.pioenvs/esp32doit-devkit-v1/lib14e/Embedded Template Library_ID930/binary.cpp.o] Error 1
    In file included from .piolibdeps/Embedded Template Library_ID930/src/crc16.cpp:33:0:
    .piolibdeps/Embedded Template Library_ID930/src/platform.h:49:25: fatal error: etl_profile.h: No such file or directory
    
    opened by GeorgeFlorian 41
  • Cannot compile on TI Code Composer Studio

    Cannot compile on TI Code Composer Studio

    Hi everyone,

    I've been trying to compile a very simple application for a TI TMS570 using TI Code Composer Studio (version 9.0.1).

    As mentioned in the ETL documentation, I defined the macro __STDC_LIMIT_MACROS in the project properties (I wasn't sure about which value to set though).

    My application uses a very simple class called from the sys_main.c.

    #include "etl/vector.h"
    
    class MyClass {
    public:
        typedef etl::vector<etl::vector<uint8_t, 14>, 32> Container;
    
        typedef struct{
            etl::vector<uint16_t, 14> subVector;
        }Cell_Voltage_t;
    
    
        MyClass(size_t newSize);
        etl::ivector<Cell_Voltage_t>& GetFullVector(void);
    
        virtual ~MyClass();
    
    private:
        etl::vector<Cell_Voltage_t, 32> mVector;
    
    };
    

    However, since the main function is in a C file I had to implement a simple wrapper :

    #include "MyClass.h"
    
    typedef void* MyClass_t;
    
    extern "C" {
    	MyClass_t CreateMyClassInstance(size_t newSize){
                return new MyClass(newSize);
            }
    	
    	etl::ivector<Cell_Voltage_t>& GetFullVector(MyClass_t pMyClass){
    	    MyClass* pClass = static_cast<MyClass*>(pMyClass);
    	    return pClass->GetFullVector();
            }
    }
    

    And finally, sys_main.c

    #include "MyClassWrapper.h"
    
    int main(void)
    {
        /* USER CODE BEGIN (3) */
        /****************************************************************************
        * System Initialization
        *****************************************************************************/
        SysTick_Init();
        Wdt_Init();
    
        size_t new_size = 1;
        MyClass_t myClassInstance = CreateMyClassInstance(new_size);
    
        while(1){
        }
    
        return 0;
    }
    

    This application does not compile using TI Code Composer Studio v9.0.1 with compiler version 18.12.2 LTS. It does however compile using GCC and using Atollic TrueStudio.

    • Step 1 : Vector.h can't find <new> + some errors about methods being ambiguous. vector.h, line 41: fatal error #1965: cannot open source file "new" and etl\stl\alternate\utility.h", line 98: error #268: "std::pair" is ambiguous

    compilation_output_step1.txt

    After searching a little bit, I changed #include <new> to #include_next <new.stdh> to match the TI CCS directory structure. This solves the first compilation error but generates a lot more in different parts of the ETL code.

    • Step 2: Bunch of errors in TI's new implementation and in ETL.

    compilation_output_step2.txt

    I'm pretty sure that this is due to a misconfiguration, but apart from the C (set to C99 by default) or C++ version (set to C++14 by CCS, and cannot be changed...) which can't be modified and the macro mentioned in the documentation, I can't find anything!

    Anyone having a similar experience on this aspect?

    Thanks!

    opened by morannen 37
  • Error(?) messages when installing on Arduino IDE

    Error(?) messages when installing on Arduino IDE

    When installing Embedded Template Library v19.3.4 from the Library Manager in Arduino IDE 1.8.13, I get many instances of the following messages in the console.

    Invalid library found in C:\Users\me\Documents\Arduino\libraries\Embedded_Template_Library: no headers files (.h) found in C:\Users\me\Documents\Arduino\libraries\Embedded_Template_Library

    I think the relevant info to resolve the issue would probably be found here: https://arduino.github.io/arduino-cli/latest/library-specification/

    bug enhancement 
    opened by bmcdonnell 34
  • how to use an ETL container on an

    how to use an ETL container on an "external" memory bank

    I am using some nice non volatile FRAM chips (my specific modules are https://www.adafruit.com/product/4719 from Adafruit, but I guess the exact model makes no difference). These are nice, big banks of "external" non volatile memory.

    I would like to have some ETL containers living fully (i.e., both the data buffer, and the "container magics" around them) on such an external memory bank. These have a very simple API, something like:

    fram.write8(address, byte_value);
    fram.read8(address);
    

    This allows to write and read individual bytes of data at individual addresses easily.

    Any way / how to make an ETL container live on such an external memory bank with an API to access it? I looked at the documentation but did not find hints of how I could do something like this.

    opened by jerabaul29 32
  • Test Compilation Errors with Clang

    Test Compilation Errors with Clang

    When I compile the unit tests with GCC, all test files compile successfully. When I compile with Clang (currently using OS X Clang), the following files fail to compile with a consistent error pattern:

    'test/test_deque.cpp',
    'test/test_flat_map.cpp',
    'test/test_flat_multimap.cpp',
    'test/test_flat_multiset.cpp',
    'test/test_flat_set.cpp',
    'test/test_map.cpp',
    'test/test_multimap.cpp',
    'test/test_multiset.cpp',
    'test/test_reference_flat_map.cpp',
    'test/test_reference_flat_multimap.cpp',
    'test/test_reference_flat_multiset.cpp',
    'test/test_reference_flat_set.cpp',
    'test/test_pearson.cpp',
    'test/test_set.cpp',
    'test/test_string_view.cpp',
    'test/test_to_u16string.cpp',
    'test/test_to_u32string.cpp',
    'test/test_to_string.cpp',
    'test/test_to_wstring.cpp',
    'test/test_unordered_map.cpp',
    'test/test_unordered_multimap.cpp',
    'test/test_unordered_multiset.cpp',
    'test/test_unordered_set.cpp',
    

    This is the primary error pattern:

    In file included from ../test/test_flat_multimap.cpp:29:
    In file included from /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/UnitTest++.h:1:
    In file included from /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/UnitTestPP.h:6:
    In file included from /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/CheckMacros.h:6:
    /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/Checks.h:24:32: error: invalid operands to binary expression ('basic_ostream<char, std::__1::char_traits<char> >' and 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator')
             stream << "Expected " << expected << " but was " << actual;
             ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
    ../test/test_flat_multimap.cpp:437:7: note: in instantiation of function template specialization 'UnitTest::CheckEqual<etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator, etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator>' requested here
          CHECK_EQUAL(constData.begin(), std::begin(constData));
          ^
    /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/CheckMacros.h:151:27: note: expanded from macro 'CHECK_EQUAL'
          #define CHECK_EQUAL UNITTEST_CHECK_EQUAL
                              ^
    /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/CheckMacros.h:40:17: note: expanded from macro 'UNITTEST_CHECK_EQUAL'
          UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
                    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:218:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'const void *' for 1st argument; take the address of the argument with &
        basic_ostream& operator<<(const void* __p);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/type_traits:4830:3: note: candidate function template not viable: no known conversion from 'basic_ostream<char, std::__1::char_traits<char> >' to 'std::byte' for 1st argument
      operator<< (byte  __lhs, _Integer __shift) noexcept
      ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:194:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'std::__1::basic_ostream<char> &(*)(std::__1::basic_ostream<char> &)' for 1st argument
        basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&))
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:198:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'basic_ios<std::__1::basic_ostream<char, std::__1::char_traits<char> >::char_type, std::__1::basic_ostream<char, std::__1::char_traits<char> >::traits_type> &(*)(basic_ios<std::__1::basic_ostream<char, std::__1::char_traits<char> >::char_type, std::__1::basic_ostream<char, std::__1::char_traits<char> >::traits_type> &)' (aka 'basic_ios<char, std::__1::char_traits<char> > &(*)(basic_ios<char, std::__1::char_traits<char> > &)') for 1st argument
        basic_ostream& operator<<(basic_ios<char_type, traits_type>&
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:203:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'std::__1::ios_base &(*)(std::__1::ios_base &)' for 1st argument
        basic_ostream& operator<<(ios_base& (*__pf)(ios_base&))
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:206:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'bool' for 1st argument
        basic_ostream& operator<<(bool __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:207:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'short' for 1st argument
        basic_ostream& operator<<(short __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:208:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'unsigned short' for 1st argument
        basic_ostream& operator<<(unsigned short __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:209:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'int' for 1st argument
        basic_ostream& operator<<(int __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:210:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'unsigned int' for 1st argument
        basic_ostream& operator<<(unsigned int __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:211:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'long' for 1st argument
        basic_ostream& operator<<(long __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:212:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'unsigned long' for 1st argument
        basic_ostream& operator<<(unsigned long __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:213:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'long long' for 1st argument
        basic_ostream& operator<<(long long __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:214:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'unsigned long long' for 1st argument
        basic_ostream& operator<<(unsigned long long __n);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:215:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'float' for 1st argument
        basic_ostream& operator<<(float __f);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:216:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'double' for 1st argument
        basic_ostream& operator<<(double __f);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:217:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'long double' for 1st argument
        basic_ostream& operator<<(long double __f);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:219:20: note: candidate function not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'basic_streambuf<std::__1::basic_ostream<char, std::__1::char_traits<char> >::char_type, std::__1::basic_ostream<char, std::__1::char_traits<char> >::traits_type> *' (aka 'basic_streambuf<char, std::__1::char_traits<char> > *') for 1st argument
        basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
                       ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:755:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'char' for 2nd argument
    operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:788:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'char' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __os, char __c)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:795:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'signed char' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:802:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'unsigned char' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:816:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'const char *' for 2nd argument
    operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:862:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'const char *' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:869:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'const signed char *' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:877:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'const unsigned char *' for 2nd argument
    operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1061:1: note: candidate function template not viable: no known conversion from 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator' to 'const std::__1::error_code' for 2nd argument
    operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:748:1: note: candidate template ignored: deduced conflicting types for parameter '_CharT' ('char' vs. 'etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator')
    operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:809:1: note: candidate template ignored: could not match 'const _CharT *' against 'etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator'
    operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1044:1: note: candidate template ignored: could not match 'basic_string<type-parameter-0-0, type-parameter-0-1, type-parameter-0-2>' against 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator'
    operator<<(basic_ostream<_CharT, _Traits>& __os,
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1069:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-2>' against 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator'
    operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1088:1: note: candidate template ignored: could not match 'bitset<_Size>' against 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator'
    operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1034:1: note: candidate template ignored: requirement '!is_lvalue_reference<basic_ostream<char> &>::value' was not satisfied [with _Stream = std::__1::basic_ostream<char> &, _Tp = etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator]
    operator<<(_Stream&& __os, const _Tp& __x)
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1052:1: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0, type-parameter-0-1>' against 'etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator'
    operator<<(basic_ostream<_CharT, _Traits>& __os,
    ^
    /Library/Developer/CommandLineTools/usr/include/c++/v1/ostream:1081:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-2, type-parameter-0-3>' against 'const etl::ireference_flat_multimap<int, TestDataNDC<std::__1::basic_string<char> >, etl::less<int> >::const_iterator'
    operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p)
    ^
    4 warnings and 2 errors generated.
    [104/125] Compiling C++ object 'etl_un..._vector_pointer_external_buffer.cpp.o'
    

    A secondary pattern that occurs is:

    In file included from ../test/test_string_view.cpp:29:
    In file included from /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/UnitTest++.h:1:
    In file included from /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/UnitTestPP.h:6:
    In file included from /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/CheckMacros.h:6:
    /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/Checks.h:24:32: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup
             stream << "Expected " << expected << " but was " << actual;
                                   ^
    ../test/test_string_view.cpp:386:7: note: in instantiation of function template specialization 'UnitTest::CheckEqual<etl::basic_string_view<char, etl::char_traits<char> >, etl::basic_string_view<char, etl::char_traits<char> > >' requested here
          CHECK_EQUAL(view1, sub);
          ^
    /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/CheckMacros.h:151:27: note: expanded from macro 'CHECK_EQUAL'
          #define CHECK_EQUAL UNITTEST_CHECK_EQUAL
                              ^
    /usr/local/Cellar/unittest-cpp/2.0.0/include/UnitTest++/CheckMacros.h:40:17: note: expanded from macro 'UNITTEST_CHECK_EQUAL'
          UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
                    ^
    ../test/test_string_view.cpp:57:17: note: 'operator<<' should be declared prior to the call site or in namespace 'etl'
      std::ostream& operator << (std::ostream& os, const View& view)
                    ^
    1 error generated.
    
    bug 
    opened by phillipjohnston 29
  • ETL migration from 15.4.2 to 18.14.1

    ETL migration from 15.4.2 to 18.14.1

    Compiler : GNU ARM GCC 9-2019-q4-major CPP version : c++14

    Hello, My project was working fine with the ETL (15.4.2), i would like to megrate the ETL to it latest version (18.14.1). But when i replace the include folder in my project, it doesn't compile anymore !! A lot of errors like :

    ell/algorithm.h:2159:3: error: ‘ETL_NODISCARD’ does not name a type
    error: ‘pair’ in namespace ‘std’ does not name a template type
    etl/utility.h:116:5: error: ‘ETL_CONSTEXPR’ does not name a type
      116 |     ETL_CONSTEXPR pair()
    etl/utility.h:123:5: error: ‘ETL_CONSTEXPR14’ does not name a type
    etl/iterator.h:70:13: error: ‘ETL_OR_STD’ does not name a type
    etl/iterator.h:273:5: error: ‘ETL_CONSTEXPR17’ does not name a type
      273 |     ETL_CONSTEXPR17 reverse_iterator(const reverse_iterator<TOther>& other)
    etl/integral_limits.h:136:35: error: ‘CHAR_BIT’ was not declared in this scope
    etl/memory.h:418:27: error: ‘distance’ is not a member of ‘etl’; did you mean ‘std::distance’?
      418 |     count += int32_t(etl::distance(i_begin, i_end));
    etl/private/pvoidvector.h:625:47: error: 'equal' is not a member of 'etl'; did you mean 'equal_to'?
      625 |     return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
    
    

    The only definition i used in the Makefile is CXXFLAGS += -DPROFILE_ARM_V7_GENERIC

    My question: What are the steps to migrate my project as there have been a lot of changes since 15.4.2 ? Thank you

    opened by Tarik06 27
  • undefined behaviour and memory issues.

    undefined behaviour and memory issues.

    What happened

    Hi, you've created a great library! But i discovered that source code of tests and maybe source code of library itself contains multiple instances of at least two kinds of problems:

    1. undefined behavior
    2. memory issues.

    How to reproduce

    It can be easily reproduced by addition of "-fsanitize=address,undefined" to CMAKE_CXX_FLAGS on every supported compiler. As for example:

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
    

    Or for single type of check:

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
    

    You can checkout concrete example for gcc/clang from this commit

    You can see failing results in github actions ci.

    Reports example

    • Undefined behavior example
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:264:7: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:278:7: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:279:7: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:282:7: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:283:7: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:332:37: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/test_array_wrapper.cpp:353:37: runtime error: index -1 out of bounds for type 'int [5]'
    /home/runner/work/etl/etl/test/../include/etl/bit.h:163:19: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
    /home/runner/work/etl/etl/test/test_bit.cpp:184:19: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
    /home/runner/work/etl/etl/test/../include/etl/bit.h:163:19: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int'
    /home/runner/work/etl/etl/test/test_bit.cpp:184:19: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int'
    /home/runner/work/etl/etl/test/../include/etl/bitset.h:454:28: runtime error: left shift of negative value -128
    /home/runner/work/etl/etl/test/../include/etl/bit_stream.h:237:44: runtime error: left shift of negative value -91
    /home/runner/work/etl/etl/test/../include/etl/bit_stream.h:237:44: runtime error: left shift of negative value -37
    
    • Address issue example
    ==4661==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffe36665b90 at pc 0x55db03f737cc bp 0x7ffe366655e0 sp 0x7ffe366655d0
    READ of size 8 at 0x7ffe36665b90 thread T0
        #0 0x55db03f737cb in (anonymous namespace)::Suitetest_callback_timer_interrupt::Testcallback_timer_interrupt_log_timer_calls::RunImpl() const::{lambda()#1}::operator()() const (/home/runner/work/etl/etl/test/etl_tests+0xadce7cb)
        #1 0x55db03f7b96f in void etl::delegate<void ()>::lambda_stub<(anonymous namespace)::Suitetest_callback_timer_interrupt::Testcallback_timer_interrupt_log_timer_calls::RunImpl() const::{lambda()#1}>(void*) (/home/runner/work/etl/etl/test/etl_tests+0xadd696f)
        #2 0x55db03ef9d84 in etl::delegate<void ()>::operator()() const (/home/runner/work/etl/etl/test/etl_tests+0xad54d84)
        #3 0x55db03f7a7fb in etl::icallback_timer_interrupt<(anonymous namespace)::ScopedGuard>::tick(unsigned int) (/home/runner/work/etl/etl/test/etl_tests+0xadd57fb)
        #4 0x55db03f74e41 in (anonymous namespace)::Suitetest_callback_timer_interrupt::Testcallback_timer_interrupt_log_timer_calls::RunImpl() const (/home/runner/work/etl/etl/test/etl_tests+0xadcfe41)
        #5 0x55db0b51dcc2 in void UnitTest::ExecuteTest<UnitTest::Test>(UnitTest::Test&, UnitTest::TestDetails const&, bool) (/home/runner/work/etl/etl/test/etl_tests+0x12378cc2)
        #6 0x55db0b51d8e3 in UnitTest::Test::Run() (/home/runner/work/etl/etl/test/etl_tests+0x123788e3)
        #7 0x55db0b52113e in UnitTest::TestRunner::RunTest(UnitTest::TestResults*, UnitTest::Test*, int) const (/home/runner/work/etl/etl/test/etl_tests+0x1237c13e)
        #8 0x55db0b521bbb in int UnitTest::TestRunner::RunTestsIf<UnitTest::True>(UnitTest::TestList const&, char const*, UnitTest::True const&, int) const (/home/runner/work/etl/etl/test/etl_tests+0x1237cbbb)
        #9 0x55db0b51ff17 in UnitTest::RunAllTests() (/home/runner/work/etl/etl/test/etl_tests+0x1237af17)
        #10 0x55db034d36d2 in main (/home/runner/work/etl/etl/test/etl_tests+0xa32e6d2)
        #11 0x7f1eafcf1c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
        #12 0x55db034d35e9 in _start (/home/runner/work/etl/etl/test/etl_tests+0xa32e5e9)
    
    Address 0x7ffe36665b90 is located in stack of thread T0 at offset 928 in frame
        #0 0x55db03f744a5 in (anonymous namespace)::Suitetest_callback_timer_interrupt::Testcallback_timer_interrupt_log_timer_calls::RunImpl() const (/home/runner/work/etl/etl/test/etl_tests+0xadcf4a5)
    

    Why it matters

    Brief analysis of issues in repository suggested, that some tools already warned at least about undefined behavior elements in test code: array index issue but were explicitly ignored. Even though this particular linked issue isn't a big deal by itself. But it can have negative effects on final code quality:

    1. New versions of compilers have optimization strategies based on assumption, that program isn't ill-formed and doesn't have undefined behavior code. Under that assumption, the optimizer can optimize away some checks inside tests, so they will never have a chance to report when some regression bug happens.
    2. Ignoring a whole category of ub bugs in the assumption that it only contains "silly" stuff from "too pedantic" check inside of test code - can hide some real bugs in code.
    3. stl/boost and other well established libraries on market all can pass its tests without ubsan/asan errors. Some organizations have policies to have this checks on and passing. So some of potential users couldn't use this library.
    4. Any memory related bugs can prohibit usage of fuzzing techniques because they usually use sanitizers too.
    5. I've started poking around with these flags after I encountered, that tests doesn't pass/or hang under my machine using gcc10.3 and gcc 11.2 and clang 13.0.1. And they have different behavior under different compilers. So my guess, that some issues found by asan/ubsan - are real problems(in tests themselves or in library code).

    ping @jwellbelove

    bug 
    opened by melg8 24
  • Issue compiling (clang & cmake)

    Issue compiling (clang & cmake)

    Hi,

    I am using WSL and clang to compile a binary for Arduino. I am including <etl/bitset.h> but when I try to compile I am getting the following error:

    /home/part22/avr-llvm/llvm-project/build/bin/clang++ --target=avr -DARDUINO=10813 -DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO -DF_CPU=16000000L -I/home/part22/projects/arduino-clang/source/include -isystem /home/part22/projects/arduino-clang/source/third-party/etl/include -mmcu=atmega328p -nostdlib -Os -DNDEBUG -fno-lto -fdata-sections -fno-exceptions -ffunction-sections -fno-threadsafe-statics -std=c++17 -MD -MT CMakeFiles/blinky.dir/blink.cpp.obj -MF CMakeFiles/blinky.dir/blink.cpp.obj.d -o CMakeFiles/blinky.dir/blink.cpp.obj -c /home/part22/projects/arduino-clang/source/blink.cpp
    In file included from /home/part22/projects/arduino-clang/source/blink.cpp:1:
    In file included from /home/part22/projects/arduino-clang/source/third-party/etl/include/etl/bitset.h:43:
    /home/part22/projects/arduino-clang/source/third-party/etl/include/etl/integral_limits.h:123:39: error: in-class initializer for static data member is not a constant expression
        static const unsigned short max = USHRT_MAX;
                                          ^~~~~~~~~
    /home/part22/avr-llvm/llvm-project/build/lib/clang/12.0.0/include/limits.h:55:33: note: expanded from macro 'USHRT_MAX'
    #define USHRT_MAX (__SHRT_MAX__ *2  +1)
                      ~~~~~~~~~~~~~~^~~~~~~
    

    I am not sure what I did wrong here. If anyone has had the same issue, I would be glad to know how I can solve this. I am happy to provide more details if needed.

    Cheers!

    opened by part22 23
  • Keil 5 (armcc 5) compilation issues.

    Keil 5 (armcc 5) compilation issues.

    Hello, There are some armcc5 compilation issues with version 18.19.2 when c++11 profile is enabled.

    1. https://github.com/ETLCPP/etl/blob/65fa8c51e4b47c4d36ab982cb31cbc65af5e27b2/include/etl/type_traits.h#L754 Previously there was a fix for armcc5:

      #if ETL_CPP11_SUPPORTED && !defined(ETL_COMPILER_ARM5)
      

      now it is gone.

    2. basic_string.h fails to compile due flags.h with following errors:

       "statement may not appear in a constexpr function" value ? data |= (pattern & MASK) : data &= (~pattern & MASK)
      

      Probably it is due limited (buggy) constexpr support for armcc5.

    3. There is a warning for function.h in line: https://github.com/ETLCPP/etl/blob/65fa8c51e4b47c4d36ab982cb31cbc65af5e27b2/include/etl/function.h#L185 because virtual keyword is missing.

    bug 
    opened by rolan-reznik 21
  • `state_chart` does not support const-qualified actions and guards

    `state_chart` does not support const-qualified actions and guards

    Current behaviour: state_chart does not support const-qualified actions and guards. Minimal example:

    #include "etl/state_chart.h"
    using namespace etl;
    
    struct SM : public state_chart<SM> {
        SM() : state_chart<SM>(*this, transitionTable.begin(), transitionTable.end(), stateTable.begin(), stateTable.end(), 0) {};
    
        bool always() { return true; };
        // instead, this does not compile:
        // bool always() const { return true; };
    
        void action() { };
        // instead, this does not compile:
        // void action() const { };
    
        static const array<SM::state, 1> stateTable;
        static const array<SM::transition, 1> transitionTable;
    };
    
    constexpr array<SM::state, 1> SM::stateTable = { SM::state(0, &SM::action, nullptr) };
    constexpr array<SM::transition, 1> SM::transitionTable = { SM::transition(0, 0, 0, &SM::action, &SM::always) };
    
    enhancement 
    opened by Gb268 2
  • Optional with pod type does not compile when using emplace

    Optional with pod type does not compile when using emplace

    In the optional emplace method for pod types the storage is accessed by get_reference method. But this method is only supported by non-pod types optional.

    opened by Chiraffollo 0
  • Signed/unsigned warnings

    Signed/unsigned warnings

    Hi, We would like to compile our code with "-Wsign-conversion" but enabling and using etl::string<> this emits a lot of warnings like `C:/projects/integrator/3rdParty/etl/include/etl/basic_string.h:1064:44: warning: conversion to 'etl::string_base::size_type' {aka 'unsigned int'} from 'std::iterator_traits<char*>::difference_type' {aka 'int'} may change the sign of the result [-Wsign-conversion]

    1064 | const size_type start = etl::distance(begin(), position); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~`

    Is there a workaround for this or is this a bug in ETL? BR

    bug 
    opened by Rasmus-Fink 4
  • range-v3

    range-v3 "ranges::to" not working with "etl::vector"

    The following short sample program demonstrates the issue:

    #include <iostream>
    #include <vector>
    #include <etl/string.h>
    #include <etl/vector.h>
    #include <range/v3/all.hpp>
    
    using Name = etl::string<20>;
    
    static constexpr auto ExpandName = [](const auto& name) { return ranges::views::repeat_n(name, 3); };
    
    int main()
    {
        {
            using Names = std::vector<Name>;
            auto names{Names{Name{"Fred"}, Name{"Sam"}, Name{"Peter"}}};
            auto expandedNames{names | ranges::views::transform(ExpandName) | ranges::views::join | ranges::to<Names>};
            for (const auto& name : expandedNames)
                std::cout << name.data() << std::endl;
        }
    
        {
            using Names = etl::vector<Name, 100>;
            auto names{Names{Name{"Fred"}, Name{"Sam"}, Name{"Peter"}}};
    
             // The following line will not compile
            auto expandedNames{names | ranges::views::transform(ExpandName) | ranges::views::join | ranges::to<Names>};
    
        }
    
        return 0;
    }
    

    Using ETL 20.35.0 and Range-v3 0.12.0, the error messages from gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, executing gcc -Ietl/include -Irange-v3/include main.cpp are:

    etl/include/etl/iterator.h:64:51: error: no type named ‘iterator_category’ in ‘struct ranges::common_iterator<ranges::basic_iterator<ranges::join_view<ranges::transform_view<ranges::ref_view<etl::vector<etl::stri
    ng<20>, 100> >, <lambda(const auto:10&)> > >::cursor<false> >, ranges::default_sentinel_t>’
       64 |     typedef typename TIterator::iterator_category iterator_category;
          |                                                   ^~~~~~~~~~~~~~~~~                                                                                                                                         etl/include/etl/iterator.h:65:51: error: no type named ‘value_type’ in ‘struct ranges::common_iterator<ranges::basic_iterator<ranges::join_view<ranges::transform_view<ranges::ref_view<etl::vector<etl::string<20>,
     100> >, <lambda(const auto:10&)> > >::cursor<false> >, ranges::default_sentinel_t>’
       65 |     typedef typename TIterator::value_type        value_type;
          |                                                   ^~~~~~~~~~             
    etl/include/etl/iterator.h:67:51: error: no type named ‘pointer’ in ‘struct ranges::common_iterator<ranges::basic_iterator<ranges::join_view<ranges::transform_view<ranges::ref_view<etl::vector<etl::string<20>, 10
    0> >, <lambda(const auto:10&)> > >::cursor<false> >, ranges::default_sentinel_t>’
       67 |     typedef typename TIterator::pointer           pointer;     
          |                                                   ^~~~~~~    
    etl/include/etl/iterator.h:68:51: error: no type named ‘reference’ in ‘struct ranges::common_iterator<ranges::basic_iterator<ranges::join_view<ranges::transform_view<ranges::ref_view<etl::vector<etl::string<20>, 
    100> >, <lambda(const auto:10&)> > >::cursor<false> >, ranges::default_sentinel_t>’
       68 |     typedef typename TIterator::reference         reference;
    
    bug 
    opened by pwhittin 3
  • Feature request: addition of etl::expected

    Feature request: addition of etl::expected

    Could it be possible to add etl::expected, matching the c++23 std::expected. Because the lack of exceptions on my AVR platform, I have used etl::variant for this, but having a more standard way would be better. This could be a replacement of etl::result.

    feature request 
    opened by jputcu 2
Releases(20.35.4)
  • 20.35.4(Nov 25, 2022)

  • 20.35.3(Nov 23, 2022)

  • 20.35.2(Nov 16, 2022)

  • 20.35.1(Nov 9, 2022)

    #628 Fixed set of ETL_NO_STL flag in meson.build #631 unique_ptr derived copy or move to base does not compile Removed duplicate include in etl::array_view

    Source code(tar.gz)
    Source code(zip)
  • 20.35.0(Oct 31, 2022)

    #596 Helper functions to convert strings to numeric values. etl::to_arithmetic #600 Fix 'maybe-uninitialized' g++ error on macros #601 Move __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS before #include <stdint.h> #602 Replace ETL_COMPILER_ICCAVR by ETL_COMPILER_IAR #603 Add back/front insert iterator #604 Update-test-sources-in-meson-build #605 Special case check for hashing -0.0 #606 Fix non-usage of key equal function #610 Added select1st and select2nd #612 Automatically detect native endianness for IAR compiler platform #613 Fix bare assert in reference_counted_object.h #614 unaligned types: use unsigned storage type #615 Addition of etl::expected (partial). Implementation of etl::unexpected #616 Provide cmake library for UnitTest++ #618 fix bug in find_next of (new) bitset class #621 No need to initialize the C-compiler, small speed improvement #626 Empty etl::optional ctor storage initialization performance Removed constexpr for etl::bit_cast due to unreliability of compiler support Added has_value() as an alias for is_value() for etl::result (consistancy with STL conventions) Added ETL_ERROR_WITH_VALUE macro for exceptions that require a value Changed scaling template parameter for etl::scaled_rounding to uint32_t Remove redundant etl::pair functions Updated string_view and char traits

    Source code(tar.gz)
    Source code(zip)
  • 20.34.0(Sep 12, 2022)

    Changed explicit message constructor for unsupported message types Added etl::circular_iterator and circular iterator extensions to etl::span Added etl::bitset_ext Added etl::lsb_mask, etl::make_lsb_mask, etl::msb_mask and etl::make_msb_mask to binary utilities Updates for unordered maps and sets for an API that better matches the STL Fixes for etl::result<void, TError> Deleted copy constructors for etl::circular_buffer_ext, etl::indirect_vector_ext and etl::vector_ext to eliminate dangling pointers Fix non-C++03 code syntax Fixed unordered container equality tests to match STL #581 Hash function for enums #583 Permit non-default-constructable hashes and key-equals #584 unordered_set::const_iterator has incorrect value_type #585 Fixed etl::result<void> being unusable due to deleted default constructor #587 Fixed IAR build warnings in message_packet #589 Add minmax_push.h/minmax_pop.h includes #593 Workaround for __has_include(<...>) and ICCAVR #591 Automatically define __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS

    Source code(tar.gz)
    Source code(zip)
  • 20.33.0(Aug 24, 2022)

    Added etl::message_broker to message framework Added 'successor' parameter constructors to all etl::imessage_router derived classes Added etl::binary_search to algorithm.h Standardise conditional compilation macros for ETL_USING_CPP11 and ETL_USING_STL #546: Added a new variant of bitset that may be constexpr Removed the use of ETL_FORCE_CONSTEXPR_ALGORITHMS as all algorithms may be constexpr Rationalised etl::send_message functions Fixed implicit virtual warning for etl::vector Fixed C++03 delegate compatibility Added missing char_traits unit tests and char_traits bug fixes Added default message id constructors Added ability to set the bitset from wchar_t, char16_t and char32_t Added ARM5 and ARM6 compiler compatibility for GCC atomics #579: Fixed Unexpected namespace for variant with non-CPP11 compiler #580: Fixed numeric_limits redefinition for gnu c++20

    Source code(tar.gz)
    Source code(zip)
  • 20.32.1(Jul 28, 2022)

  • 20.32.0(Jul 28, 2022)

    #571 Activate GCC and clang compiler warnings #575 Bip buffer improvements #576 Invoke function pointers with parenthesis #574 Allow users to remove SYSTEM keyword because it forces C linkage for some gcc versions

    Source code(tar.gz)
    Source code(zip)
  • 20.31.3(Jul 24, 2022)

    #569 Fixed swap function for circular_buffer_ext #568 Fixed circular_buffer iterator -> operators Optimised container move for external buffers for etl::list and etl::forward_list Added functions and macros to etl::debug_count Added tests for error handler macros

    Source code(tar.gz)
    Source code(zip)
  • 20.31.2(Jul 20, 2022)

  • 20.31.1(Jul 17, 2022)

    Addition of extra ETL_NODISCARD and ETL_NOEXCEPT to etl::span & etl::poly_span. Fixed warnings for initialisation order for some etl::poly_span constructors.

    Source code(tar.gz)
    Source code(zip)
  • 20.31.0(Jul 14, 2022)

    Added etl::poly_span, a std::span concept for polymorphic object types. Refactored parts of etl::span, including prevent compound statements in constexpr methods for C++11 Added etl::is_enum to type_traits.h

    Source code(tar.gz)
    Source code(zip)
  • 20.30.1(Jul 12, 2022)

    Refactored legacy variant to remove upcast functors. Added upcast_ptr, is_base_of & 'not a base' error exception to legacy variant. If ETL_USE_LEGACY_VARIANT is defined then legacy variant is in the etl namespace. If ETL_USE_LEGACY_VARIANT is not defined then legacy variant is in the etl::legacy namespace. Added non-member etl::send_message for etl::shared_message Green Hills compiler compatibility

    Source code(tar.gz)
    Source code(zip)
  • 20.29.3(Jun 27, 2022)

  • 20.29.2(Jun 24, 2022)

  • 20.29.1(Jun 23, 2022)

  • 20.29.0(Jun 23, 2022)

    Added etl::bit_stream_writer Added etl::bit_stream_reader Deprecated etl::bit_stream Added callback option to etl::byte_stream_writer Added error exceptions to byte_stream_writer Added ETL_NODISCARD to etl::delegate create and is_valid functions Added etl::visit support to etl::variant Refactored C++17 message_packet Refactored etl::atomic implementations to allow non-(integrals/pointers/bool) Refactors etl::vector and etl::deque resize() to take const reference parameter Renamed ETL_ALWAYS_ASSERT to ETL_ASSERT_FAIL Removed duplicate void_t definition Removed duplicate etl::declvar definition Renamed cumulative_moving_average to pseudo_windowed_moving_average to more accurately reflect its algorithm. Changed etl::debounce internal state names to avoid clashes with Arduino macros.

    Source code(tar.gz)
    Source code(zip)
  • 20.28.0(May 19, 2022)

    Fixed issues raised by sanitizer. Added conditional compilation for 8 bit type in hash.h Fixed warnings for 64bit compilation. Fixed sanity check includes. Fixed incorrect returned span length for byte stream read. Updates to etl::successor and derived classes.

    Source code(tar.gz)
    Source code(zip)
  • 20.27.3(Apr 11, 2022)

    #531 Fixed compilation error of etl::reference_counted_message_pool with ETL_LOG_ERROR enabled, due to non-public inheritance of base exception class.

    Source code(tar.gz)
    Source code(zip)
  • 20.27.2(Apr 9, 2022)

    Added scripts to automatically update version information. Added ETL version information to etl::traits. Small optimisations for computing indexes for queues & cyclic_value. #530 Fixed: etl::nth_type not implemented correctly. #521 CMake: Add package version file for installation. #525 Fixed: cplusplus constant type. #517 Fixed: unused-local-typedefs warning.

    Source code(tar.gz)
    Source code(zip)
  • 20.27.1(Mar 24, 2022)

  • 20.27.0(Mar 24, 2022)

    Removed universal reference version of the template function etl::observer::notify_observers due to issues with movable notification types.

    Added:- etl::functor - A function object wrapper for static/global functions. etl::member_function_wrapper - A wrapper for a member function. Creates a static member function that calls the specified member function. etl::functor_wrapper - A wrapper for a functor. Creates a static member function that calls the specified functor.

    Source code(tar.gz)
    Source code(zip)
  • 20.26.0(Mar 22, 2022)

    Added constexpr support for etl::unaligned_type. Added etl::traits namespace containing traits mirroring many ETL macros. Traits are const for C++03, constexpr for C++11 and above. Removed some uses of GCC builtins due to compatibilty with constexpr. etl::swap is now ETL_CONSTEXPR14. Changed ETL_ENDIANNESS_IS_CONSTEXPR to ETL_HAS_CONSTEXPR_ENDIANNESS. Changed ETL_CONSTEXPR17 to ETL_CONSTEXPR14 for reverse iterators Added template wrappers around memcpy, memmove, memcmp, memset & memchr. The counter in etl::debug_count is atomic, if available. Embedded essential UnitTest++ source into the project, as it is no longer maintained on GitHub.

    Source code(tar.gz)
    Source code(zip)
  • 20.25.0(Mar 7, 2022)

    Added message_timer_interrupt Added callback_timer_interrupt Changed message_timer_atomic and callback_timer_atomic to require an atomic counter template type. Added extra condition compile macros to control std::initializer_list. Initializer list tests are in a separate project. Modified etl::instance_count to take an optional counter type. Renamed Arduino files to stop PlatformIO getting confused. Changed from C cast to C++ cast in memory.h Always use stddef.h Modified WCHAR_MIN and WCHAR_MAX checks. Added char8_t type. Fixed 'unused function parameter' warnings.

    Source code(tar.gz)
    Source code(zip)
  • 20.24.1(Feb 21, 2022)

    Callback and message timers now use etl::timer_semaphore_t instead of etl::atomic_uint_least16_t Fixed send_message function signatures to remove compiler warnings. Fixed #include guard in initializer_list.h.

    Source code(tar.gz)
    Source code(zip)
  • 20.24.0(Feb 16, 2022)

    #503 Algorithm transform uses expensive post increment operator - Fixed for all occurences of iterator increment. #504 ETL_CONSTANT vs const in binary.h - Fixed. Many algorithms will leverage built-ins, if available. Dependant on compiler version. Added detection or selection of built-ins. Much of etl::string and etl::string_view can be constexpr. Added ETL initializer_list implementations that are compatible with major compilers. Added etl::construct_at support. Added etl::byte Re-implemented etl::singleton

    Source code(tar.gz)
    Source code(zip)
  • 20.23.0(Jan 24, 2022)

    Recoded state_chart to reduce its resource requirements. Added compile time state chart variants. Added etl::unaligned_type for fundamental types. Added reverse engineered functionality from C++20 . Added all permutations of leading/trailing bit tests. Changed inline functions to templates in binary.h. Added etl::midpoint and etl::lerp Recoded etl::endian & etl::endianness to allow constexpr in certain configurations. Updates and fixes to etl::bitset. Added to_ulong, to_ullong, to_string member functions. Moved void_t definition. Renamed 8bit check macro. Updated tests to support C++20 STL. Modified C++ language level detection. Added all permutations of leading/trailing bit tests. etl::iterator is more SFINAE compatible. Updated C++ standard detection.

    Source code(tar.gz)
    Source code(zip)
  • 20.22.0(Dec 28, 2021)

    Split callback and message timer to atomic and locked interrupt versions. No use of macros required. C++03 compatible etl::delegate. #480 Fixed: Double formatting with precision > 9 #481 Fixed: etl::span const data cannot be created from non const c array of data. #482 Fixed: Two or more etl::span/array_view of different types create ambiguous overloading set #483 Fixed: Added Green Hills compiler to minmax push and pop. #484 Fixed: etl::vector test_uninitialized_resize_excess not calling uninitialized_resize. #485 Fixed: etl::message_packet takes message types that are not in its list.

    Source code(tar.gz)
    Source code(zip)
  • 20.21.0(Dec 5, 2021)

    Added support for transparent comparators. When ETL_NO_ATOMICS is defined the timer.h file does not define timer_semaphore_t. etl::deque::resize throws etl::deque_full instead of etl::deque_out_of_bounds, if requested size is too large.

    Source code(tar.gz)
    Source code(zip)
Owner
Embedded Template Library
A C++ template library for embedded projects
Embedded Template Library
An open-source C++ library developed and used at Facebook.

Folly: Facebook Open-source Library What is folly? Folly (acronymed loosely after Facebook Open Source Library) is a library of C++14 components desig

Facebook 23.8k Dec 3, 2022
Functional Programming Library for C++. Write concise and readable C++ code.

FunctionalPlus helps you write concise and readable C++ code. Table of contents Introduction Usage examples Type deduction and useful error messages T

Tobias Hermann 1.7k Nov 28, 2022
KoanLogic 392 Nov 27, 2022
? A glib-like multi-platform c library

A glib-like cross-platform C library Supporting the project Support this project by becoming a sponsor. Your logo will show up here with a link to you

TBOOX 4.2k Nov 27, 2022
NIH Utility Library

libnih is a light-weight "standard library" of C functions to ease the development of other libraries and applications. Its goals are: * despite it

Scott James Remnant 80 Sep 15, 2022
An open source library for C

Homo Deus - C Library Introduction The Homo Deus C Library (hdelibc) is an open source collection of tools for the C programming language. The project

Homo Deus 113 Nov 28, 2022
Embedded Template Library

Embedded Template Library (ETL) Motivation C++ is a great language to use for embedded applications and templates are a powerful aspect. The standard

Embedded Template Library 1.4k Nov 26, 2022
A place to collaborate on code for the Embedded.fm book club. Currently reading "STM32 ARM Programming for Embedded Systems".

Welcome to the Book Club Code site! This is a place for the Embedded.fm book club to collaborate and learn together. Repo Structure Guide Top-level fo

Peter Griffin 11 Jul 21, 2022
Embedded Flutter runtime targeting Embedded Linux with Wayland

ivi-homescreen IVI Homescreen for Wayland Strongly Typed (C++) Lightweight Clang 11 Release Stripped = 151k GCC 9.3 Release Stripped = 168k Source run

null 170 Dec 1, 2022
Lab2: using a physical embedded systems to interact with virtual embedded systems.

Lab2: dotDevice EmSys Autumn 2021 In this lab you will use your TinyPico to interact with a virtual embedded system. Current Virtual Lab URL: [http://

Shane Fleming 1 Oct 20, 2021
This is a C plus plus coding template for Compitative programming. This template is very optimized for the Online Judgment

C-plusplus-compitative-Programming-Template Tech We Used C++ Features Easy to compile Easy debug facility Analysised and optimized base template Steps

Alan Binu 15 Jan 27, 2022
FSD-Template - A template UE4.25 project for BP modding.

FSD-Template Project generated by Archengius' UE4 Template Generator. Reflected C++ classes generated by CheatingMuppet & Archengius' UE4SS UHT Genera

null 16 Nov 22, 2022
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.

OpenGL Template Engine is a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects. This is the template I personally use for my own projects and provides me with the general OpenGL 3D render setup with model import and UI.

Marcus Nesse Madland 2 May 16, 2022
F Graphics Library (FGL) is a small graphics C++ portable library for LCD displays on embedded systems

F Graphics Library (FGL) Full documentation: fgl.docsforge.com (By Filipe Chagas) F Graphics Library is a C++ library that I created for use in embedd

Filipe Chagas 9 Oct 31, 2022
Bolt is a C++ template library optimized for GPUs. Bolt provides high-performance library implementations for common algorithms such as scan, reduce, transform, and sort.

Bolt is a C++ template library optimized for heterogeneous computing. Bolt is designed to provide high-performance library implementations for common

null 358 Nov 14, 2022
A lightweight C++ machine learning library for embedded electronics and robotics.

Fido Fido is an lightweight, highly modular C++ machine learning library for embedded electronics and robotics. Fido is especially suited for robotic

The Fido Project 412 Sep 19, 2022
C++ library for creating an embedded Rest HTTP server (and more)

The libhttpserver reference manual Tl;dr libhttpserver is a C++ library for building high performance RESTful web servers. libhttpserver is built upon

Sebastiano Merlino 705 Nov 28, 2022
data compression library for embedded/real-time systems

heatshrink A data compression/decompression library for embedded/real-time systems. Key Features: Low memory usage (as low as 50 bytes) It is useful f

Atomic Object 1.1k Dec 1, 2022
A lightweight C++ machine learning library for embedded electronics and robotics.

Fido Fido is an lightweight, highly modular C++ machine learning library for embedded electronics and robotics. Fido is especially suited for robotic

The Fido Project 412 Sep 19, 2022
📟 JSON library for Arduino and embedded C++. Simple and efficient.

ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things). Features JSON deserialization Optionally decodes UTF-16 escape sequences t

Benoît Blanchon 5.9k Nov 30, 2022