Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          metaprogramming/conditional-declaration/point.h - Class Point header file - where move is only enabled for floating point types.Lecture 6 - slide 36 : 40
Program 1

// Point<C> where move is only enabled for floating point types.

#include <type_traits>

// One of the usual syntactical embellishments, here of enable_if. 
template <bool B, typename T>
using Enable_if = typename std::enable_if<B,T>::type;

template<typename C>class Point {
private: 
  C x, y;

public:
  Point(C, C);
  Point();
  C getx () const;
  C gety () const;
  Enable_if<std::is_floating_point<C>::value, Point<C>>& move(C, C);   // if C is not a floating point type, 
                                                                       // the move function is not present.
  double distance_to(Point);
};

template<class C>  std::ostream& operator<< (std::ostream&, const Point<C>&);