By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,192 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,192 IT Pros & Developers. It's quick & easy.

Template Instantiation

P: 105
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(const 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.
Mar 19 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 3,652
Exactly what arguments did you pass in the writ() function? I suspect this is where an error is being made.
Mar 19 '07 #2

P: 105
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>("datafile.v",flase,false);

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?
Mar 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.