lundi 4 septembre 2017

cpp what exactly is a variable template

I am getting c++11 warnings about variable templates. I'm not entirely sure that I need them, because I'm not entirely sure what they are. References that I've found don't bother defining the term before using it. My immediate thought was that it was an attempt to declare a variable that is of the templated type T, but this code compiles fine:

template <class T>
image<T> *image<T>::copy() const {
  image<T> *im = new image<T>(w, h, false);
  memcpy(im->data, data, w * h * sizeof(T));
  return im;
}

What is a thorough definition of a variable template, and why does this NOT have a variable template problem

Aucun commentaire:

Enregistrer un commentaire