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-2020, Michał Policht <michal@policht.pl>. All rights reserved.
42 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
43 //(c)C: This file is a part of CuteHMI.
44 //(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.
45 //(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.
46 //(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/>.
47 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
48 //(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
49 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
50 //(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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