Template Instantiation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mickey22
    New Member
    • Feb 2007
    • 105

    Template Instantiation

    Hi all,

    I have a class template and I am trying to use its memeber function in my project.I have passed all the parameters to this function but still I get warning as

    ////warning C4244: 'argument' : conversion from 'uint64' to 'size_t', possible loss of data
    1> while compiling class template member function 'void R<T>::writ(cons t uint64,T *const ,const uint64)'
    1> with
    1> [
    1> T=float
    1> ]
    1> .\filt.cpp(61) : see reference to class template instantiation 'R<T>' being compiled
    1> with
    1> [
    1> T=float
    1> ]
    ///////////////////////////////////////////////


    filt.cpp is my project's source file and R is class template I am using it.I have used the pointer to this class template as

    R <float> *ptr=NULLL;
    ptr->writ( passed the necessary arguments);

    I am not able to understand where my error is.Could anyone please help me with this?Thanks in advance.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Exactly what arguments did you pass in the writ() function? I suspect this is where an error is being made.

    Comment

    • mickey22
      New Member
      • Feb 2007
      • 105

      #3
      The arguments that I have passed are writ(offset, data,size);

      where unsigned long int oft=(unsigned long int)x*(unsigned long int)y*slice;

      data=new float[(unsigned long int)x*(unsigned long int)y*(unsigned long int)bytes);

      size=(unsigned long int)x*(unsigned long int)y;

      ptr->new R<float>("dataf ile.v",flase,fa lse);

      R constructor has these arguments to give the filename and whether the data is to be read/write and whether data in little endian/big endian format

      Basically I am trying to read a data file and read from particular offset oft and put in the buffer data.

      Am I doing some type casting wrong?

      Comment

      Working...