aboutsummaryrefslogtreecommitdiff
path: root/src/STLUtil.hh
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-28 06:22:38 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-28 06:22:38 (GMT)
commit0ec165e85b313588d43dbdc2450da9838c4c528f (patch)
treeaee798a6f8f108908e3e6932bef11b8eb564aa2a /src/STLUtil.hh
parent32eb2a148ea7a257a058658af36e9f8c801a524a (diff)
downloadfluxbox-0ec165e85b313588d43dbdc2450da9838c4c528f.zip
fluxbox-0ec165e85b313588d43dbdc2450da9838c4c528f.tar.bz2
move STLUtil to FbTk
Diffstat (limited to 'src/STLUtil.hh')
-rw-r--r--src/STLUtil.hh56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/STLUtil.hh b/src/STLUtil.hh
deleted file mode 100644
index a9b08e0..0000000
--- a/src/STLUtil.hh
+++ /dev/null
@@ -1,56 +0,0 @@
1// STLUtil.cc for fluxbox
2// Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id$
23
24
25#ifndef STLUTIL_HH
26#define STLUTIL_HH
27
28/// contains useful utilities for STL
29namespace STLUtil {
30
31/// calls delete on each item in the container and then clears the container
32template <typename A>
33void destroyAndClear(A &a) {
34 typedef typename A::iterator iterator;
35 iterator it = a.begin();
36 iterator it_end = a.end();
37 for (; it != it_end; ++it)
38 delete (*it);
39
40 a.clear();
41}
42
43/// calls delete on each item value in the map and then clears the map
44template <typename A>
45void destroyAndClearSecond(A &a) {
46 typedef typename A::iterator iterator;
47 iterator it = a.begin();
48 iterator it_end = a.end();
49 for (; it != it_end; ++it)
50 delete it->second;
51 a.clear();
52}
53
54};
55
56#endif // STLUTIL_Hh