liveBook · Manning

Is_constructible

As explained in Learn C++ by Example

is_constructible is a C++ type trait that determines whether a type can be constructed from a specified set of argument types.

is_constructible is a C++ type trait that checks at compile time whether a type can be created from a specified set of argument types. Include <type_traits> and read its Boolean result through value or the C++17 _v shorthand. section 6.1.4

Checking a polymorphic base class

For the abstract Race::Blob class, static_assert can verify that default, copy, and move construction are unavailable while destruction remains supported. The same check_properties function can inspect assignment and other special member functions. section 6.1.4

How Learn C++ by Example covers it

How deep it goes
Defines value and _v queries, argument packs, and static_assert checks, but does not detail implementation internals.
Examples
Uses abstract Race::Blob, default construction, construction from int, and static_assert checks for copying, moving, assignment, and destruction.
What it assumes
Assumes basic C++ types and constructors while introducing type traits, compile-time Boolean values, and parameter packs.
What you can do after
Diagnose construction capabilities at compile time with trait queries and static_assert.
How it connects
Connects type traits with templates, static_assert, special member functions, concepts, and abstract classes.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn C++ by Example. The section links point to the parts of the book it draws on.