|
||||
File indexing completed on 2025-01-30 10:03:40
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2020-2024 UT-Battelle, LLC, and other Celeritas developers. 0003 // See the top-level COPYRIGHT file for details. 0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0005 //---------------------------------------------------------------------------// 0006 //! \file corecel/cont/ArrayIO.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <ostream> 0011 #include <sstream> 0012 #include <string> 0013 0014 #include "Array.hh" 0015 #include "SpanIO.hh" 0016 0017 namespace celeritas 0018 { 0019 //---------------------------------------------------------------------------// 0020 /*! 0021 * Write the elements of array \a a to stream \a os. 0022 */ 0023 template<class T, size_type N> 0024 std::ostream& operator<<(std::ostream& os, Array<T, N> const& a) 0025 { 0026 os << make_span(a); 0027 return os; 0028 } 0029 0030 //---------------------------------------------------------------------------// 0031 /*! 0032 * Convert an array to a string representation for debugging. 0033 */ 0034 template<class T, size_type N> 0035 std::string to_string(Array<T, N> const& a) 0036 { 0037 std::ostringstream os; 0038 os << a; 0039 return os.str(); 0040 } 0041 0042 //---------------------------------------------------------------------------// 0043 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |