boostorg / boostorg/any

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

Open
#23 1 comment 0 reactions 0 assignees View on GitHub
enhancement PR welcomed
Dominant language
C++
Stars
37
Forks
60
Avg merge
5d 22h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.