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

vector class MinIndex method in Dev c++

P: 71
I am using Dev C++ however getting errors when I call MinIndev method from a vector.

Expand|Select|Wrap|Line Numbers
  1. #include <vector>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6.  
  7. {
  8.  
  9.   vector<double> parameter_range(4, 2.0);
  10.   vector<double> result (parameter_range.size(), parameter_range.MinIndex());
  11.  
  12. }
So here I do not get an error when I use size(). However, I get "..........has no member named MinIndex" error. I would appreciate any insight.

Emre
Jun 10 '07 #1
Share this Question
Share on Google+
5 Replies


Expert 10K+
P: 11,448
Have a look at the vector class documentation. The compiler is right:
there is no such member function. Who or what gave you the idea that there
was such a function?

kind regards,

Jos
Jun 10 '07 #2

AdrianH
Expert 100+
P: 1,251
I am using Dev C++ however getting errors when I call MinIndev method from a vector.

Expand|Select|Wrap|Line Numbers
  1. #include <vector>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6.  
  7. {
  8.  
  9.   vector<double> parameter_range(4, 2.0);
  10.   vector<double> result (parameter_range.size(), parameter_range.MinIndex());
  11.  
  12. }
So here I do not get an error when I use size(). However, I get "..........has no member named MinIndex" error. I would appreciate any insight.

Emre
Perhaps you wanted to use the algorithm min_element()? The result is kinda obvious though. 2.0.


Adrian
Jun 10 '07 #3

P: 71
OK, thanks for the clarification. It seems that the code I have borrowed is not using the standard vector class. I guess this MinIndex function only works for some special compilers.
Jun 10 '07 #4

Expert 10K+
P: 11,448
OK, thanks for the clarification. It seems that the code I have borrowed is not using the standard vector class. I guess this MinIndex function only works for some special compilers.
No, it's not the compiler (at least I hope not), it's the definition of the class
template. Better stick to the STL and don't use any proprietary libs that don't
supply any decent documentation.

kind regards,

Jos
Jun 10 '07 #5

AdrianH
Expert 100+
P: 1,251
One way to determine if it is a STL function/class is that STL doesn't use camel case, it has underscores ('_') between words.


Adrian
Jun 10 '07 #6

Post your reply

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