Concepts and Auto


#include <concepts>

// This syntax constrains the auto parameters you pass in
// To comply with the std::integral concept

std::integral auto add(std::integral auto a, std::integral auto b) {
  return a + b;
}

// Constraint declared auto var. Not that useful for declaring a variable, but could be useful for calling a function.
std::integral auto x = add(10, 20);
std::floating_point auto y = 7.7;