473,508 Members | 3,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vector class MinIndex method in Dev c++

71 New Member
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
5 2427
JosAH
11,448 Recognized Expert MVP
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
1,251 Recognized Expert Top Contributor
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
curious2007
71 New Member
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
JosAH
11,448 Recognized Expert MVP
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
1,251 Recognized Expert Top Contributor
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

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

Similar topics

16
2707
by: Kitty | last post by:
Hi, everyone. Given a vector<int>, what is the fastest way to find out whether there is a repeated element in it? The result is just "true" or "false". Thanks. Kitty
8
1530
by: Hamish | last post by:
I havea program which on execution gives unpredictable behaviour (it shouldn't). In trying to track down the problem, I'm wondering if there is a difference between these two ways of filling a...
6
1325
by: Martin S. | last post by:
the class: public __gc class Vector { private: Double y, x, z; public: Vector() { y(0),
4
1919
by: shuisheng | last post by:
Dear All, I have a question. Assume #include <vector> using namespace std; class A { private:
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7333
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
7398
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...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.