template <class T>
boost::function<void*(const T&, const T&)> getVerxFunc2()
{
BOOST_STATIC_ASSERT(boost::is_integral<T>::value || boost::is_floating_point<T>::value);
return (boost::is_floating_point<T>::value) ? &glVertex2d : &glVertex2i;
}
template <class T>
boost::function<void*(const T&, const T&, const T&)> getVerxFunc3()
{
BOOST_STATIC_ASSERT(boost::is_integral<T>::value || boost::is_floating_point<T>::value);
return (boost::is_integral<T>::value) ? &glVertex3i : &glVertex3d;
}
template <class T>
void drawDot(const T& x, const T& y) {
boost::function<void(const T&, const T&)> myFunc(getVerxFunc2<T>());
glBegin(GL_POINTS);
myFunc(x, y);
glEnd();
glFlush();
}
template <class T>
void drawDot(const T& x, const T& y, const T& z) {
boost::function<void(const T&, const T&, const T&)> myFunc(getVerxFunc3<T>());
glBegin(GL_POINTS);
myFunc(x, y, z);
glEnd();
glFlush();
}
template <class T>
void drawLine(const T& x1, const T& y1, const T& x2, const T& y2) {
boost::function<void(const T&, const T&)> myFunc(getVerxFunc2<T>());
glBegin(GL_LINE);
myFunc(x1, y1);
myFunc(x2, y2);
glEnd();
glFlush();
}