FEDEM Model Database  R8.0
Source code of the FEDEM model database
FmArray.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FM_ARRAY_H
9 #define FM_ARRAY_H
10 
11 #include <array>
12 #include <iostream>
13 
14 
15 template<size_t N>
16 std::ostream& operator<<(std::ostream& os, const std::array<int,N>& arr)
17 {
18  os << arr.front();
19  for (size_t i = 1; i < N; i++) os <<" "<< arr[i];
20  return os;
21 }
22 
23 template<size_t N>
24 std::istream& operator>>(std::istream& is, std::array<int,N>& arr)
25 {
26  std::array<int,N> tmp;
27  for (int& i : tmp) is >> i;
28  if (is) arr = tmp;
29  return is;
30 }
31 
32 #endif
std::istream & operator>>(std::istream &is, std::array< int, N > &arr)
Definition: FmArray.H:24
std::ostream & operator<<(std::ostream &os, const std::array< int, N > &arr)
Definition: FmArray.H:16