lxgui
Loading...
Searching...
No Matches
include
lxgui
utils_std.hpp
1
#ifndef LXGUI_UTILS_STD_HPP
2
#define LXGUI_UTILS_STD_HPP
3
4
#include "lxgui/lxgui.hpp"
5
6
#include <algorithm>
7
#include <array>
8
#include <iostream>
9
#include <vector>
10
11
namespace
lxgui::utils
{
12
13
template
<
typename
C,
typename
T>
14
auto
find
(C& v,
const
T& s) {
15
return
std::find(v.begin(), v.end(), s);
16
}
17
18
template
<
typename
C,
typename
T>
19
auto
find_if
(C& v, T&& f) {
20
return
std::find_if(v.begin(), v.end(), std::forward<T>(f));
21
}
22
23
}
// namespace lxgui::utils
24
25
namespace
std
{
26
27
template
<
class
T, std::
size_t
N>
28
ostream&
operator<<
(ostream& o,
const
array<T, N>& a) {
29
o <<
"("
;
30
for
(std::size_t i = 0; i < N; ++i) {
31
if
(i != N - 1)
32
o << a[i] <<
", "
;
33
else
34
o << a[i];
35
}
36
o <<
")"
;
37
return
o;
38
}
39
40
template
<
class
T>
41
ostream&
operator<<
(ostream& o,
const
vector<T>& a) {
42
o <<
"("
;
43
const
std::size_t n = a.size();
44
for
(std::size_t i = 0; i < n; ++i) {
45
if
(i != n - 1)
46
o << a[i] <<
", "
;
47
else
48
o << a[i];
49
}
50
o <<
")"
;
51
return
o;
52
}
53
54
}
// namespace std
55
56
#endif
lxgui::utils
Definition
utils_exception.cpp:3
lxgui::utils::find
auto find(C &v, const T &s)
Definition
utils_std.hpp:14
lxgui::utils::find_if
auto find_if(C &v, T &&f)
Definition
utils_std.hpp:19
std
STL namespace.
std::operator<<
ostream & operator<<(ostream &o, const array< T, N > &a)
Definition
utils_std.hpp:28
Generated on Mon Apr 21 2025 18:06:23 for lxgui by
1.9.8