-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
It's not possible to change internal or external size of std::vector that stores te::poly objects, nor emplace_back objects into it.
Example with reserving space in the vector:
#include "external/te/include/te.hpp"
#include <vector>
struct Drawable
{
auto draw() -> REQUIRES(void, draw)
};
int main()
{
std::vector<te::poly<Drawable>> drawables;
drawables.reserve(1);
}
Its compilation fails with:
/usr/include/c++/7/type_traits:1162: error: invalid use of incomplete type ‘struct std::is_constructible<te::v1::poly<Drawable>, te::v1::poly<Drawable, te::v1::dynamic_storage, te::v1::static_vtable>&&>’
struct __is_move_constructible_impl<_Tp, true>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we change reserve to resize, we get the same error and additionally this one:
/usr/include/c++/7/bits/stl_construct.h:75: error: no matching function for call to ‘te::v1::poly<Drawable>::poly()’
{ ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we change the code to test emplace_back with a potentially drawable object:
struct Circle
{
void draw() {}
};
int main()
{
std::vector<te::poly<Drawable>> drawables;
drawables.emplace_back(Circle{});
}
we get the same error as in the reserve case.
Environment
OS: Ubuntu 17.10 x64
Compiler: GCC 7.2 x64
Metadata
Metadata
Assignees
Labels
No labels