Hello

I have a the following code:

#include <vector>

class myClass {
   private:
     std::vector<Genode::Trace::Subject_id>  mSubjectList;

   public:
     bool hasSubjectId(Genode::Trace::Subject_id aSubjectId) const {
       return std::find(mSubjectList.begin(), mSubjectList.end(),  
aSubjectId) != mSubjectList.end();
     }
}

If I try to compile it, I get the following error:
/home/pirmin/Documents/genode/genode/contrib/stdcxx-fadf4f6ba436fe4846572f00bf057c5ef290c25b/include/stdcxx/bits/stl_algo.h:168:4:
 error: passing ‘const Genode::Trace::Subject_id’ as ‘this’ argument of ‘bool 
Genode::Trace::Subject_id::operator==(const Genode::Trace::Subject_id&)’ 
discards qualifiers  
[-fpermissive]

In base/trace/types.h the signature of the operator==() for Subject_id  
is defined as follows:
bool operator == (Subject_id const &other) { return id == other.id; }

Shouldnt it be?
bool operator == (Subject_id const &other) const { return id == other.id; }

Most recomendations on operator overloading, I have read, recommend this.

Best regards
Pirmin



------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to