fork download
  1. #include <algorithm>
  2. #include <array>
  3. #include <vector>
  4.  
  5. template <typename T, int VAL>
  6. T addValue(T const& x)
  7. {
  8. return x + VAL;
  9. }
  10.  
  11. int main(int argc, char* argv[])
  12. {
  13. std::array<float, 3> array = {0.1f, 0.2f, 0.3f};
  14. std::vector<float> source(array.begin(), array.end());
  15. std::vector<float> dest(3);
  16.  
  17. std::transform(source.begin(), source.end(), dest.begin(), (float(*)(float const&))addValue<float, 4>);
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3024KB
stdin
Standard input is empty
stdout
Standard output is empty