Celeritas  0.5.0-56+6b053cd
Classes | Functions
corecel/io/Repr.hh File Reference
#include <iomanip>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "corecel/OpaqueId.hh"
#include "corecel/cont/Array.hh"
#include "corecel/cont/Span.hh"
#include "corecel/data/Collection.hh"
#include "corecel/math/Quantity.hh"
#include "Join.hh"
#include "detail/ReprImpl.hh"
This graph shows which files directly or indirectly include this file:

Classes

struct  celeritas::ReprTraits< T >
 Traits for writing an object for diagnostic or testing output. More...
 
struct  celeritas::ReprTraits< float >
 
struct  celeritas::ReprTraits< double >
 
struct  celeritas::ReprTraits< char >
 
struct  celeritas::ReprTraits< unsigned char >
 
struct  celeritas::ReprTraits< bool >
 
struct  celeritas::ReprTraits< int >
 
struct  celeritas::ReprTraits< unsigned int >
 
struct  celeritas::ReprTraits< long >
 
struct  celeritas::ReprTraits< unsigned long >
 
struct  celeritas::ReprTraits< long long >
 
struct  celeritas::ReprTraits< unsigned long long >
 
struct  celeritas::ReprTraits< std::string_view >
 
struct  celeritas::ReprTraits< std::string >
 
struct  celeritas::ReprTraits< char * >
 
struct  celeritas::ReprTraits< char[N]>
 
struct  celeritas::ReprTraits< char const * >
 
struct  celeritas::ReprTraits< std::pair< T1, T2 > >
 Specialization for printing std::pairs. More...
 
struct  celeritas::ReprTraits< OpaqueId< V, S > >
 Specialization for OpaqueId. More...
 
struct  celeritas::ReprTraits< Quantity< U, V > >
 Specialization for Quantity. More...
 
struct  celeritas::ContTraits< Container >
 
struct  celeritas::ContTraits< T[N]>
 
struct  celeritas::ContainerReprTraits< Container >
 Get a string representation of a container of type T. More...
 
struct  celeritas::ReprTraits< std::vector< T, A > >
 
struct  celeritas::ReprTraits< Array< T, N > >
 
struct  celeritas::ReprTraits< T[N]>
 
struct  celeritas::ReprTraits< Span< T, N > >
 
struct  celeritas::ReprTraits< Collection< T, W, MemSpace::host, I > >
 Print collection host data. More...
 
struct  celeritas::ReprTraits< Collection< T, W, MemSpace::device, I > >
 Print placeholder for device data. More...
 

Functions

template<class T >
detail::Repr< T > celeritas::repr (T const &obj, char const *name=nullptr)
 Return a streamable object that prints out a C++-style. More...
 

Function Documentation

◆ repr()

template<class T >
detail::Repr<T> celeritas::repr ( T const &  obj,
char const *  name = nullptr 
)

Return a streamable object that prints out a C++-style.

Example:

std::cout << repr(my_vec) << std::endl;
detail::Repr< T > repr(T const &obj, char const *name=nullptr)
Return a streamable object that prints out a C++-style.
Definition: corecel/io/Repr.hh:44

The 'name' argument defaults to null (just printing the value); if a string is given a full variable declaration such as std::string foo{"bar"} will be printed. If the name is empty, an anonymous value std::string{"bar"} will be printed.