Professional Documents
Culture Documents
C++17 Small Features
C++17 Small Features
int main()
{
int high = 100, low = 10;
int num1 = 120;
int num2 = 5;
int num3 = 50;
num1 = std::clamp(num1, low, high); // 100
num2 = std::clamp(num2, low, high); // 10
num3 = std::clamp(num3, low, high); // 50
std::cout << num1 << " " << num2 << " " << num3;
}
-----------------------------------------------------------------------------
// std::any
#include <iostream>
#include <unordered_map>
#include <string>
#include <any>
int main() {
// Create an unordered_map with string keys and std::any values
std::unordered_map<std::string, std::any> myMap;
return 0;
}