tuple.cpp 651 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. */
  3. #include <cxxomfort/base.hpp>
  4. #include <cxxomfort/tuple.hpp>
  5. #include <iostream>
  6. #include <string>
  7. struct Z {
  8. int z0;
  9. char const* z1;
  10. float z2;
  11. };
  12. int main () {
  13. using namespace std;
  14. typedef tuple<int,char const*,float> TU;
  15. TU Tu1 (0, "Hola Mundo", 3.14);
  16. cout<< tuple_size<TU>::value<< endl;
  17. cout<< "tu1_1: "<< get<1>(Tu1)<< endl;
  18. TU Tu2;
  19. Tu2= Tu1;
  20. get<0>(Tu2)= 12;
  21. cout<< "tu2_0: "<< get<0>(Tu2)<< endl;
  22. cout<< "tu1_0: "<< get<0>(Tu1)<< endl;
  23. Z z;
  24. tie(z.z0, ignore, z.z2) = Tu2;
  25. //tie(z.z0, z.z1, z.z2) = Tu2;
  26. cout<< "z0: "<< z.z0<< endl;
  27. }