libcrn
3.9.5
A document image processing library
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
libcrn
CRNData
CRNForeach.h
Go to the documentation of this file.
1
/* Copyright 2009-2016 INSA Lyon, CoReNum
2
*
3
* This file is part of libcrn.
4
*
5
* libcrn is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Lesser General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* libcrn is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with libcrn. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* file: CRNForeach.h
19
* \author Yann LEYDIER
20
*/
21
22
#ifndef CRNForeach_HEADER
23
#define CRNForeach_HEADER
24
25
#include <memory>
26
30
37
#define CRN_ADD_RANGED_FOR_TO_POINTERS(TYPE) \
38
namespace std { \
39
inline auto begin(const std::unique_ptr<TYPE> &v) -> decltype (v->begin()) { return v->begin(); } \
40
inline auto begin(const std::shared_ptr<TYPE> &v) -> decltype (v->begin()) { return v->begin(); } \
41
inline auto end(const std::unique_ptr<TYPE> &v) -> decltype (v->end()) { return v->end(); } \
42
inline auto end(const std::shared_ptr<TYPE> &v) -> decltype (v->end()) { return v->end(); } \
43
}
44
51
#define CRN_ADD_RANGED_FOR_TO_CONST_POINTERS(TYPE) \
52
namespace std { \
53
inline auto begin(const std::unique_ptr<const TYPE> &v) -> decltype (v->cbegin()) { return v->cbegin(); } \
54
inline auto begin(const std::shared_ptr<const TYPE> &v) -> decltype (v->cbegin()) { return v->cbegin(); } \
55
inline auto end(const std::unique_ptr<const TYPE> &v) -> decltype (v->cend()) { return v->cend(); } \
56
inline auto end(const std::shared_ptr<const TYPE> &v) -> decltype (v->cend()) { return v->cend(); } \
57
}
58
61
#endif
62
63
Generated on Thu Sep 7 2017 13:54:25 for libcrn by
1.8.6