Skip to content

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

Open
@gloinart

Description

@gloinart

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions