Modernes C++ programmieren

Okt 23, 2024

lst-0301-godb.cpp

//#(compile) c++; compiler:g132; options:-O3 -std=c++23; libs:-
// https://godbolt.org/z/hT8o3dqrK 
#include <vector>
#include <set>
#include <iostream> // cout
#include <concepts> // integral
#include <iterator> // output_iterator, input_iterator
using namespace std;
using vector_t = vector<unsigned long long>;        // Ihr eigener Typalias
int main() {
  vector_t huge{ 12ULL, 10000000000ULL, 9ULL, 0ULL,  };
  unsigned_integral auto sz = huge.size();
  unsigned_integral auto uiuiui = huge[1];
  signed_integral auto meh = huge[1];               //             (ERR)  Concept nicht erfüllt
  input_or_output_iterator auto itx = huge.begin(); // Concept ohne Parameter
  for(output_iterator<unsigned long long> auto i=huge.begin();
      it!=huge.end(); ++it)
    *it *= 2; // verdoppeln
  /* sortieren per set */
  set sortiert(huge.begin(), huge.end());           // set<vector_t::value_type>
  for(const unsigned_integral auto& val : sortiert)
    cout << val << " ";
  cout << "\n";
}