473,586 Members | 2,490 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 2436
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
2717
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
1546
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 std::vector with data: Method 1: std::vector<int> v; int k; for(i=0;i<n;i++){
6
1336
by: Martin S. | last post by:
the class: public __gc class Vector { private: Double y, x, z; public: Vector() { y(0),
4
1921
by: shuisheng | last post by:
Dear All, I have a question. Assume #include <vector> using namespace std; class A { private:
0
7841
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6617
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3838
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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 we have to send another system
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.