etl: can't create etl::vector of etl::delegate
Hi, is it somehow possible to create a vector of functions like in the following example?
#include <iostream>
#include <etl/vector.h>
#include <etl/delegate.h>
int func(int a) {
return a * 2;
}
int main() {
etl::vector<etl::delegate<int(int)>, 5> fvec;
fvec.push_back(etl::delegate<int(int)>::create<func>());
std::cout << fvec.front()(21) << std::endl;
}
Trying this I get some weird error messages:
.../include/etl/vector.h:975:19: error: no matching function for call to ‘destroy(etl::delegate<int(int)>*&, etl::delegate<int(int)>*&)’
975 | etl::destroy(p_buffer, p_end);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
and
/include/etl/memory.h:1035:27: error: incomplete type ‘etl::is_trivially_destructible<etl::delegate<int(int)>, false>’ used in nested name specifier
1035 | typename etl::enable_if<!etl::is_trivially_destructible<typename etl::iterator_traits<TIterator>::value_type>::value, void>::type
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (10 by maintainers)
I use gcc 9.3.0, etl 20.15.0 and C++11 on linux 64. When I switch to C++14 (which is also fine for me) is works flawless …