Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a template flag which forces the assigned object to be allocated within the any object #23

Open
gloinart opened this issue Sep 21, 2021 · 1 comment

Comments

@gloinart
Copy link

Add a templated parameter to the basic_any class which, if true, results of a compile-time error if the basic_any is assigned a too large object.

Example
struct Small{int x;};
struct Big{int x, y, z, w;};
auto a = boost::small_any<4, 4, true>{};
a = Small{};
a = Big{}; // static_assert(sizeof(T) <= OptimizeForSize) breaks the compilation

@apolukhin
Copy link
Member

I think it should be a separate data type. PRs are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants