"Fossies" - the Fresh Open Source Software Archive 
Member "regexxer-0.10/src/miscutils.h" (6 Oct 2011, 1496 Bytes) of package /linux/privat/old/regexxer-0.10.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "miscutils.h" see the
Fossies "Dox" file reference documentation.
1 /*
2 * Copyright (c) 2002-2007 Daniel Elstner <daniel.kitta@gmail.com>
3 *
4 * This file is part of regexxer.
5 *
6 * regexxer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * regexxer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with regexxer; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef REGEXXER_MISCUTILS_H_INCLUDED
22 #define REGEXXER_MISCUTILS_H_INCLUDED
23
24 namespace Util
25 {
26
27 template <class T>
28 class ScopedArray
29 {
30 private:
31 T* array_;
32
33 ScopedArray(const ScopedArray<T>&);
34 ScopedArray<T>& operator=(const ScopedArray<T>&);
35
36 public:
37 explicit ScopedArray(T* array) : array_ (array) {}
38 ~ScopedArray() { delete[] array_; }
39
40 T* get() const { return array_; }
41 };
42
43
44 /* next() and prior(): Idea shamelessly stolen from boost.
45 */
46 template <class Iterator>
47 inline Iterator next(Iterator pos) { return ++pos; }
48
49 template <class Iterator>
50 inline Iterator prior(Iterator pos) { return --pos; }
51
52 } // namespace Util
53
54 #endif /* REGEXXER_MISCUTILS_H_INCLUDED */