Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'                auto/auto4.cc - Same - illustrates deduction of a functions return type in C++14.Lecture 2 - slide 23 : 29
Program 3

// C++14 - illustrates deduction of a functions return type.

#include <iostream>    
#include <vector>
#include <cmath>    // abs
#include "point.h"

// Illustration of deduction of a function's return type (C++14):
auto find_diagonal_points(std::vector<Point> points){
  using namespace std;

  vector<Point> res;
  for(auto p: points)
    if(abs(p.getx())==abs(p.gety()))
      res.push_back(p);
  return res;
}