473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

[Warning] passing `const double' for converting

I get this long and hard to understand warning when I call a constructor:

AssocArray<double, string> myAssocArray(names, myArr);

the code for the constructor:

template <class V, class AI, class I, class S>
AssocArray<V, AI, I, S>::AssocArray(const list<AI>& names, const Array<V, I, S>& source)
{

I curr = source.MinIndex();

typename list<AI>::const_iterator it;
for (it = names.begin(); it != names.end(); it++)
{
internal_array.insert(pair<AI,I>(*it, source[curr]));

curr++;
}


}

The warning that I get:

[Warning] passing `const double' for converting 2 of `std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = std::string, _T2 = int]'

I would appreciate any insights.
Jul 5 '07 #1
2 2725
weaknessforcats
9,208 Expert Mod 8TB
You need a pair with a const double:

Expand|Select|Wrap|Line Numbers
  1. pair<int, const double> obj;
  2.  
None of your pair types are const.

Maybe:
Expand|Select|Wrap|Line Numbers
  1. internal_array.insert(pair<AI,const I>(*it, source[curr]));
  2.  
Assuming l is a double.
Jul 6 '07 #2
OK, thanks. Somehow once I restarted the compiler I stopped getting the errors.
Jul 6 '07 #3

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

Similar topics

5
by: {AGUT2} {H}-IWIK | last post by:
Hi, I'm trying to pass my vector to a function external to my main(), but my compiler is complaining. FYI, the struct for the facetInfo works perfectly, it's just the vector passing. A quick...
4
by: JR | last post by:
Hey all, I am passing a two dimensional array to a function. It basically looks like this int test(double array2 , const CONST1, const CONST2) { int returnValue; for (int i = 0;...
3
by: Steven Taylor | last post by:
Hope someone can assist. I'm trying to answer a book question. I'm going around in circles in relation to 'pointer-to-char'. Object : A short program is to be created, which involves a...
29
by: junky_fellow | last post by:
Consider the following piece of code: struct junk { int i_val; int i_val1; char c_val; }; int main(void) {
6
by: subramanian | last post by:
Consider the following program: #include <stdio.h> void myfn(const int **a) { static int i, j, k; a = &i; a = &j;
18
by: tbringley | last post by:
I am a c++ newbie, so please excuse the ignorance of this question. I am interested in a way of having a class call a general member function of another class. Specifically, I am trying to...
22
by: mdh | last post by:
Hi All, Happy Solstice! May I ask the following. The following is a brief excerpt of a practice program. main(...){ if (argc 1 && mystrcomp(argv, "-n") == 0) /* argv is "-n" / ******/...
2
by: Thelma Lubkin | last post by:
I use my own matrix and vector classes. I wrote them before such things were generally available and I've stuck with them ever since. I've just added an Octonion class derived from the vectors...
4
by: Giovanni Gherdovich | last post by:
Hello, I'm doing some toy experiments to see how the algoritm std::transform and the function adapter std::bind2nd can play together, but my compiler give my the error error: passing `const...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.