Schnek
arraycheck.hpp
1 /*
2  * arraycheck.hpp
3  *
4  * Created on: 23 Jan 2007
5  * Author: Holger Schmitz
6  * Email: holger@notjustphysics.com
7  *
8  * Copyright 2012 Holger Schmitz
9  *
10  * This file is part of Schnek.
11  *
12  * Schnek is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * Schnek is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with Schnek. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef SCHNEK_ARRAYCHECK_HPP_
28 #define SCHNEK_ARRAYCHECK_HPP_
29 
30 #include "../config.hpp"
31 #include "../macros.hpp"
32 
33 #include <cassert>
34 #include <cstddef>
35 
36 namespace schnek {
37 
38 typedef std::size_t size_t;
39 
43 template<size_t limit>
45 {
46  public:
48  SCHNEK_INLINE void check(size_t) const {}
49 };
50 
54 template<size_t limit>
56 {
57  public:
59  SCHNEK_INLINE void check(size_t i) const {
60  assert(i < limit);
61  }
62 };
63 
64 }
65 
66 #endif // SCHNEK_ARGCHECK_HPP_
Definition: algo.hpp:30
Definition: arraycheck.hpp:44
Definition: arraycheck.hpp:55
SCHNEK_INLINE void check(size_t) const
Definition: arraycheck.hpp:48
SCHNEK_INLINE void check(size_t i) const
Definition: arraycheck.hpp:59