473,805 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stl vector no match for 'operator=='

1 New Member
Hi I've created a class to be used with stl vector. I'm having a hard time decipher the error message outpout by g++...

Expand|Select|Wrap|Line Numbers
  1. burlen@quaoar:~/hdf52vtk_dev/src$ g++  junk.cpp GridPoint.o
  2. /usr/include/c++/3.3.3/bits/stl_algo.h: In function `_RandomAccessIter
  3.    std::find(_RandomAccessIter, _RandomAccessIter, const _Tp&,
  4.    std::random_access_iterator_tag) [with _RandomAccessIter =
  5.    __gnu_cxx::__normal_iterator<GridPoint*, std::vector<GridPoint,
  6.    std::allocator<GridPoint> > >, _Tp = GridPoint*]':
  7. /usr/include/c++/3.3.3/bits/stl_algo.h:298:   instantiated from `_InputIter std::find(_InputIter, _InputIter, const _Tp&) [with _InputIter = __gnu_cxx::__normal_iterator<GridPoint*, std::vector<GridPoint, std::allocator<GridPoint> > >, _Tp = GridPoint*]'
  8. junk.cpp:47:   instantiated from here
  9. /usr/include/c++/3.3.3/bits/stl_algo.h:208: error: no match for 'operator==' in
  10.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  11.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  12.    std::allocator<GridPoint> >]() == __val'
  13. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  14.    GridPoint&) const
  15. /usr/include/c++/3.3.3/bits/stl_algo.h:211: error: no match for 'operator==' in
  16.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  17.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  18.    std::allocator<GridPoint> >]() == __val'
  19. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  20.    GridPoint&) const
  21. /usr/include/c++/3.3.3/bits/stl_algo.h:214: error: no match for 'operator==' in
  22.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  23.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  24.    std::allocator<GridPoint> >]() == __val'
  25. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  26.    GridPoint&) const
  27. /usr/include/c++/3.3.3/bits/stl_algo.h:217: error: no match for 'operator==' in
  28.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  29.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  30.    std::allocator<GridPoint> >]() == __val'
  31. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  32.    GridPoint&) const
  33. /usr/include/c++/3.3.3/bits/stl_algo.h:223: error: no match for 'operator==' in
  34.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  35.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  36.    std::allocator<GridPoint> >]() == __val'
  37. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  38.    GridPoint&) const
  39. /usr/include/c++/3.3.3/bits/stl_algo.h:226: error: no match for 'operator==' in
  40.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  41.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  42.    std::allocator<GridPoint> >]() == __val'
  43. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  44.    GridPoint&) const
  45. /usr/include/c++/3.3.3/bits/stl_algo.h:229: error: no match for 'operator==' in
  46.    '(&__first)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*
  47.    [with _Iterator = GridPoint*, _Container = std::vector<GridPoint,
  48.    std::allocator<GridPoint> >]() == __val'
  49. GridPoint.h:46: error: candidates are: bool GridPoint::operator==(const
  50.    GridPoint&)




in my class I have defined it like this:

bool GridPoint::oper ator== ( const GridPoint &rhs ) const;

can you help me figure what the error messages mean?
Feb 16 '06 #1
0 6137

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

Similar topics

8
9142
by: Giulio | last post by:
I'm doing a class who takes in constructor a vector<int> keeps and makes some statistic on the vector whitout modifiing it. I would like not to make a copy of the vector for the class. to let the full process be faster a smaller in memory. I tried to pass the vector by reference using * but that operator doesn't exist. my ask is: how the vector are passed to functions?
4
2954
by: Nomak | last post by:
Hello, With this code: $ cat -n ifs.cc 1 #include <vector> 2 #include <iostream> 3 4 using std::vector; 5 using std::cin;
7
17059
by: tehn.yit.chin | last post by:
I am trying to experiment <algorithm>'s find to search for an item in a vector of struct. My bit of test code is shown below. #include <iostream> #include <vector> #include <algorithm> #include <string> struct abc_struct {
7
4695
by: imutate | last post by:
How do I implement << ala std::cout for vector template ? I already have the following: #include <vector> template < typename T > class Vec : public std::vector< T { public: Vec() { } Vec( int s ) : std::vector<T>(s) { }
22
3188
by: sandy | last post by:
I am trying to make a simulated directory structure application for a course. I am using a Vector to store pointers to my Directory objects (as subdirectories of the current object). In my header it looks like this (private section) vector<Directory*Directories;
4
1960
by: lovecreatesbea... | last post by:
The find() in <algorithmrequires two input iterators as its first and second arguments. In some of my code, I use vector<T>::begin() and vector<T>::end() as the first and second arguments. The T::operator== and T::operator!= are defined. And the code works. The begin() and end() of vector<Tare not input iterators but random access iterators, right? Why I use find() on vectors, are there something wrong? Class OgFile{
0
1675
by: PaperPilot | last post by:
While trying to copy data into the vector I get the following error messages: stl_algobase.h:247: error: no match for 'operator*' in '*__result' stl_algobase.h:249: error: no match for 'operator++' in '++__result' __result is the vector's OutputIterator the ecode segement that gives me this problem is: typedef std::vector< float > floatV;
5
6060
by: jeremit0 | last post by:
I'm trying to sort a vector<complex<double and can't figure it out. I recognize the problem is that there isn't a default operator< for complex data types. I have written my own operator and can use it, but std::sort doesn't seem to find it. I have copied a very simple example below. Everything compiles just fine when the line with std::sort function is commented out, but with that line included a whole slew of errors are given like: ...
1
5461
by: orangemonkey | last post by:
#include <iostream> #include <math.h> #include <vector> using namespace std; int main (void) { int sv = 0, fv = 0; cout << "Start Value:" << endl;
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9186
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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

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.