cppqed-multidiagonal 0.4.0
Multidiagonal sparse operator algebra for C++QED
Loading...
Searching...
No Matches
Traits.h
Go to the documentation of this file.
1// Copyright András Vukics 2006–2026. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
2#pragma once
3
5#define FWD(x) std::forward<decltype(x)>(x)
6
7#include <boost/hana.hpp>
9namespace hana=boost::hana;
10
11#include <boost/json.hpp>
12
13#include <type_traits>
14
15
16namespace cppqedutils {
17
19namespace json = boost::json ;
22using LogTree = json::object ;
23
27std::string toStringJSON(auto&& v) {return json::serialize( json::value_from( FWD(v) ) ) ;}
28
29} // cppqedutils
30
31
32namespace cppqedutils {
33
37template <typename T>
38constexpr auto passByValue_v=std::nullopt;
39
40
44template <typename State> struct ReferenceMF : std::type_identity<std::add_lvalue_reference_t<State>> {};
45
47template <typename State> using Reference = typename ReferenceMF<State>::type;
48
51template <typename State> struct ConstReferenceMF : std::type_identity<std::add_lvalue_reference_t<std::add_const_t<State>>> {};
52
54template <typename State> using ConstReference = typename ConstReferenceMF<State>::type;
55
56} // cppqedutils
#define FWD(x)
Perfect-forwarding macro. Expands to std::forward<decltype(x)>(x), avoiding the need to repeat the ty...
Definition Traits.h:5
A non-owning, strided view over a contiguous buffer. Should be passed by value.
Definition MultiArray.h:106
Definition MultiArrayComplex.h:59
Namespace alias for Boost.Hana, used for compile-time sequences and heterogeneous containers.
Definition MultiArray.h:17
constexpr auto passByValue_v
Primary template for the pass-by-value trait. Specializations are true for view types (e....
Definition Traits.h:38
typename ConstReferenceMF< State >::type ConstReference
Convenience alias for ConstReferenceMF<State>::type.
Definition Traits.h:54
std::string toStringJSON(auto &&v)
Serializes any JSON-convertible value to a string via json::value_from.
Definition Traits.h:27
json::object LogTree
Namespace alias for Boost.JSON, used for structured logging and JSON serialization.
Definition Traits.h:22
typename ReferenceMF< State >::type Reference
Convenience alias for ReferenceMF<State>::type.
Definition Traits.h:47
Metafunction yielding the const-reference type of State. Defaults to const State&....
Definition Traits.h:51
Metafunction yielding the reference type of State. Defaults to State&. Specialized for view types to ...
Definition Traits.h:44