VCTR
Loading...
Searching...
No Matches
StdOstreamOperator.h
1/*
2 ==============================================================================
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5 Copyright 2022- by sonible GmbH.
6
7 This file is part of VCTR - Versatile Container Templates Reconceptualized.
8
9 VCTR is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License version 3
11 only, as published by the Free Software Foundation.
12
13 VCTR is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License version 3 for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 version 3 along with VCTR. If not, see <https://www.gnu.org/licenses/>.
20 ==============================================================================
21*/
22
23namespace vctr
24{
25
26template <is::anyVctrOrExpression V>
27std::ostream& operator<< (std::ostream& s, const V& vec)
28{
29 if (vec.size() == 0)
30 {
31 s << "[ ]";
32 return s;
33 }
34
35 s << "[ ";
36
37 const auto n = vec.size() - 1;
38
39 size_t i = 0;
40 for (; i < n; ++i)
41 s << vec[i] << ", ";
42
43 s << vec[i] << " ]";
44
45 return s;
46}
47
48} // namespace vctr
The main namespace of the VCTR project.
Definition: Array.h:24