00001 #ifndef ATHCONTAINERS_TOOLS_COMPAREANDPRINT_H
00002 #define ATHCONTAINERS_TOOLS_COMPAREANDPRINT_H 1
00003
00004
00005
00006
00007
00008 #include <algorithm>
00009 #include <typeinfo>
00010
00011 namespace DataModel_detail {
00018 class CompareAndPrint
00019 {
00020 public:
00026 CompareAndPrint(bool quiet)
00027 : m_quiet(quiet) {}
00028
00029
00037 template <typename Element>
00038 bool operator()(Element* f, Element* s) const
00039 {
00040 bool areEq = (f == s);
00041 if (!m_quiet && areEq && f != 0)
00042 warn (typeid (*f), f);
00043 return areEq;
00044 }
00045
00046
00052
00053 void warn (const std::type_info& ti, const void* f) const;
00054
00055
00056 private:
00058 bool m_quiet;
00059 };
00060 }
00061 #endif // not ATHCONTAINERS_TOOLS_COMPAREANDPRINT_H