ATLAS Offline Software
Loading...
Searching...
No Matches
CompareAndPrint.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHCONTAINERS_TOOLS_COMPAREANDPRINT_H
6#define ATHCONTAINERS_TOOLS_COMPAREANDPRINT_H 1
7
8//****************************************************************************
9// Helpers for deleting @c DataVector/List elements.
10//
11
12#include <algorithm> /*sort, unique */
13#include <typeinfo>
14
23{
24public:
32
33
41 template <typename Element>
42 bool operator()(Element* f, Element* s) const
43 {
44 bool areEq = (f == s);
45 if (!m_quiet && areEq && f != 0)
46 warn (typeid (*f), f);
47 return areEq;
48 }
49
50
56 // This is defined out-of-line in the cxx file.
57 void warn (const std::type_info& ti, const void* f) const;
58
59
60private:
62 bool m_quiet;
63};
64} // namespace DataModel_detail
65#endif // not ATHCONTAINERS_TOOLS_COMPAREANDPRINT_H
bool operator()(Element *f, Element *s) const
Compare two pointers.
CompareAndPrint(bool quiet)
Constructor.
void warn(const std::type_info &ti, const void *f) const
Duplicate elements were found; print a warning.