FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_concept Namespace Reference

C++ concepts for type constraints and compile-time validation. More...

Concepts

concept  IsInstanceOf
 Concept to check if a type is an instance of a specific template.
 
concept  Boolean
 Concept for types that can be contextually converted to bool.
 
concept  Enum
 Concept for enumeration types.
 
concept  ScopedEnum
 Concept for scoped enumeration types (enum class)
 
concept  Variant
 Concept for std::variant types.
 
concept  Uniform
 Concept to check if all types are the same.
 
concept  Iterable
 Concept for iterable containers (has begin() and end())
 
concept  IsContainerOf
 Concept for containers holding a specific value type.
 
concept  IsVector
 Concept for std::vector types.
 
concept  IsOptional
 Concept for std::optional types.
 
concept  Container
 Concept for standard library container types.
 
concept  StringConvertible
 Concept for types implicitly convertible to std::string.
 
concept  StringConstructible
 Concept for types that can construct a std::string.
 
concept  Numeric
 Concept for numeric types (integral or floating-point)
 
concept  StreamInsertable
 Concept for types that support stream insertion (operator<<)
 
concept  StringRepresentable
 Concept for types that can be represented as a string.
 

Enumerations

enum  TestEnum { VALUE1 , VALUE2 }
 
enum class  TestEnumClass { VALUE1 , VALUE2 }
 

Variables

template<typename T, template< typename... > typename U>
constexpr bool is_instance_of_v = std::false_type {}
 Type trait to check if a type is an instance of a template.
 
template<template< typename... > typename U, typename... Args>
constexpr bool is_instance_of_v< U< Args... >, U > = std::true_type {}
 Specialization for matching template instances.
 

Detailed Description

C++ concepts for type constraints and compile-time validation.

This namespace provides a comprehensive set of C++ concepts for common type requirements, including container checks, type conversions, iterability, template instance matching, and more. Concepts enable compile-time type checking and improve template error messages.

Enumeration Type Documentation

◆ TestEnum

enum ns_concept::TestEnum

Definition at line 136 of file concept.hpp.

◆ TestEnumClass

enum class ns_concept::TestEnumClass
strong

Definition at line 137 of file concept.hpp.

Variable Documentation

◆ is_instance_of_v

template<typename T, template< typename... > typename U>
bool ns_concept::is_instance_of_v = std::false_type {}
inlineconstexpr

Type trait to check if a type is an instance of a template.

Template Parameters
TThe type to check
UThe template to match against

Definition at line 50 of file concept.hpp.

◆ is_instance_of_v< U< Args... >, U >

template<template< typename... > typename U, typename... Args>
bool ns_concept::is_instance_of_v< U< Args... >, U > = std::true_type {}
inlineconstexpr

Specialization for matching template instances.

Template Parameters
UThe template type
ArgsTemplate arguments

Definition at line 58 of file concept.hpp.