fork(2) download
  1. /// #include "stdafx.h"
  2. #include <stdio.h> ///
  3. #include <vector>
  4. #define fp32 float
  5. #define u32 unsigned int
  6. class BV
  7. {
  8. public:
  9. BV(fp32 x, fp32 y)
  10. : _x(x)
  11. , _y(y)
  12. {
  13. }
  14.  
  15. public:
  16. fp32 _x;
  17. fp32 _y;
  18. };
  19. std::pair<u32, BV&> GetValue(std::vector<BV>& values, u32 index)
  20. {
  21. /// return std::make_pair(index, values[index]);
  22. return std::make_pair<u32, BV&>(index, values[index]); ///
  23. }
  24.  
  25. void TestAll()
  26. {
  27. std::vector<BV> values;
  28. values.push_back(BV(0.0, 0.0));
  29. values.push_back(BV(2.0, 0.0));
  30. values.push_back(BV(3.0, 0.0));
  31. std::pair<u32, BV&> pair1 = GetValue(values, 0);
  32. BV& val1 = GetValue(values, 0).second;
  33. //BV& val1 = pair1.second;
  34. fp32 a = val1._x + 1.0f;
  35. std::pair<u32, BV&> pair2 = GetValue(values, 0);
  36. BV& val2 = GetValue(values, 2).second;
  37. //BV& val2 = pair1.second;
  38. fp32 b = val2._x + 1.0f;
  39. printf("val1 x = %f; y = %f;\n", val1._x, val1._y);
  40. printf("val2 x = %f; y = %f;\n", val2._x, val2._y);
  41. fp32 c = val1._x + 1.0f;
  42. printf("val1 x = %f; y = %f;\n", val1._x, val1._y);
  43. printf("val2 x = %f; y = %f;\n", val2._x, val2._y);
  44. }
  45.  
  46. /// int _tmain(int argc, _TCHAR* argv[])
  47. int main() ///
  48. {
  49. TestAll();
  50. return 0;
  51. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
val1 x = 0.000000; y = 0.000000;
val2 x = 3.000000; y = 0.000000;
val1 x = 0.000000; y = 0.000000;
val2 x = 3.000000; y = 0.000000;