C++ features by examples
20.cpp File Reference

C++20. More...

#include <bits/stdc++.h>
#include <experimental/source_location>
Include dependency graph for 20.cpp:

Go to the source code of this file.

Namespaces

namespace  lambda
 

Concepts

concept  truism
 trivial concepts as assignment
 
concept  integral
 short concept definition from a constraint directly
 
concept  integral_req_ct
 
concept  compound_requirements
 

Functions

void init_20 ()
 
void types_20 ()
 
void dynamic_memory_20 ()
 
void lambda::lambda_20 ()
 
template<typename T >
requires is_integral_v<T>
constexpr T requires_demo (T a)
 
template<typename T >
requires is_same_v<T, double>
constexpr auto requires_demo (T &&a)
 
template<class T >
requires is_signed_v<T> || (is_unsigned_v<T> && ! is_void_v<void>)
void complex_requirement_demo ()
 
template<class T >
requires requires() { true;}
void requires_expression_demo ()
 Annotated example of requires-expression. More...
 
template<class T >
requires requires(T a) { a / 0; }
constexpr auto what (T a)
 
template<class T >
requires requires(T a) { a[0]; }
constexpr auto what (T a)
 
void coroutine_demo ()
 
void location_20 ()
 source_location More...
 
void functional_20 ()
 
int main ()
 

Variables

auto to_array_demo = to_array("foo")
 to_array More...
 

Detailed Description

C++20.

Definition in file 20.cpp.

Function Documentation

◆ what()

template<class T >
requires requires(T a) { a[0]; }
constexpr auto what ( a)
constexpr

Definition at line 197 of file 20.cpp.

197{ a[0]; } auto constexpr what(T a) { return 2; }
constexpr auto what(T a)
Definition: 20.cpp:194