yat  0.12.3pre
Deleter.h
1 #ifndef _theplu_yat_utility_deleter
2 #define _theplu_yat_utility_deleter
3 
4 // $Id: Deleter.h 2858 2012-09-28 00:44:10Z peter $
5 
6 /*
7  Copyright (C) 2012 Peter Johansson
8 
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10 
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15 
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 namespace theplu {
26 namespace yat {
27 namespace utility {
28 
40  class Deleter
41  {
42  public:
49  Deleter(bool active=true);
50 
54  bool active(void) const;
55 
59  template<typename T>
60  void operator()(T* ptr) const
61  {
62  if (active_)
63  delete ptr;
64  }
65 
66  private:
67  bool active_;
68  };
69 
70 }}} // of namespace utility, yat, and theplu
71 
72 #endif
Deleter(bool active=true)
constructor
Functor that deletes an object.
Definition: Deleter.h:40
void operator()(T *ptr) const
Definition: Deleter.h:60

Generated on Mon Jun 1 2015 12:29:52 for yat by  doxygen 1.8.5