CuteHMI - CuteHMI (CuteHMI.2)
wrappers.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_2_INCLUDE_CUTEHMI_WRAPPERS_HPP
2 #define H_EXTENSIONS_CUTEHMI_2_INCLUDE_CUTEHMI_WRAPPERS_HPP
3 
4 #include <algorithm>
5 #include <iterator>
6 
7 namespace cutehmi {
8 
9 template <class INPUT_IT, class SIZE, class OUTPUT_IT>
10 OUTPUT_IT copy_n(INPUT_IT first, SIZE count, OUTPUT_IT result);
11 
12 template <class INPUT_IT1, class INPUT_IT2>
13 bool equal(INPUT_IT1 first1, INPUT_IT1 last1, INPUT_IT2 first2);
14 
15 template <class INPUT_IT, class SIZE, class OUTPUT_IT>
16 OUTPUT_IT copy_n(INPUT_IT first, SIZE count, OUTPUT_IT result)
17 {
18  // Avoid MSVC C4996 warning, when using std::copy_n with raw pointers.
19 #ifdef _MSC_VER
20  return ::std::copy_n(first, count, ::stdext::checked_array_iterator<OUTPUT_IT>(result, count)).base();
21 #else
22  return ::std::copy_n(first, count, result);
23 #endif
24 }
25 
26 template <class INPUT_IT1, class INPUT_IT2>
27 bool equal(INPUT_IT1 first1, INPUT_IT1 last1, INPUT_IT2 first2)
28 {
29  // Avoid MSVC C4996 warning, when using std::copy_n with raw pointers.
30 #ifdef _MSC_VER
31  return ::std::equal(first1, last1, ::stdext::make_unchecked_array_iterator(first2));
32 #else
33  return ::std::equal(first1, last1, first2);
34 #endif
35 }
36 
37 }
38 
39 #endif
40 
41 //(c)C: Copyright © 2019, Michał Policht <michal@policht.pl>. All rights reserved.
42 //(c)C: This file is a part of CuteHMI.
43 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
44 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
45 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
cutehmi::copy_n
OUTPUT_IT copy_n(INPUT_IT first, SIZE count, OUTPUT_IT result)
Definition: wrappers.hpp:16
cutehmi
Definition: constants.hpp:6
cutehmi::equal
bool equal(INPUT_IT1 first1, INPUT_IT1 last1, INPUT_IT2 first2)
Definition: wrappers.hpp:27