x024.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <algorithm>
4 #include <iostream>
5 #include <iterator>
6 #include <list>
7 #include <typeinfo>
8 
9 namespace nmx::apps::x024 {
10 
14 inline void ex1() {
15 //wandle Argument in Zeichenkette um
16 #define MYSTRING(x) #x
17  int n = 10;
18  std::cout << "check condition:" << MYSTRING(n > 10) << std::endl;
19  std::cout << "in file: " << __FILE__ << std::endl;
20  std::cout << "function name: " << __func__ << std::endl;
21  std::cout << "pretty function name: " << __PRETTY_FUNCTION__ << std::endl;
22  std::cout << "at line: " << __LINE__ << std::endl;
23  if (n > 10) {
24  std::cout << "is true" << std::endl;
25  } else {
26  std::cout << "is false" << std::endl;
27  }
28 }
29 
33 inline void ex2() {
34 #define ALL(x) std::begin(x), std::end(x)
35  std::list<double> lst(10);
36  std::generate_n(lst.begin(), lst.size(), []() {
37  static double x = 0;
38  return x++;
39  });
40  auto fitr = std::find_if(ALL(lst), [](double x) { return x > 5; });
41  std::copy(lst.begin(), fitr, std::ostream_iterator<double>(std::cout, ","));
42  std::cout << std::endl;
43  std::copy(ALL(lst), std::ostream_iterator<double>(std::cout, ","));
44 #undef All
45 }
46 
47 } // namespace nmx::apps::x024
void ex1()
ex1 Präprozessor-Anweisungen
Definition: x024.h:14
void ex2()
ex2
Definition: x024.h:33
#define MYSTRING(x)
#define ALL(x)