Seed Core_IO from doc snapshot
This commit is contained in:
49
tjp/core/io/IO.h
Executable file
49
tjp/core/io/IO.h
Executable file
@@ -0,0 +1,49 @@
|
||||
// License: Modified MIT (NON-AI)
|
||||
// See the LICENSE file in the root directory for license information.
|
||||
// Copyright 2025 Timothy Prepscius
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tjp/core/type_traits/always_false.hpp>
|
||||
|
||||
namespace tjp::core {
|
||||
|
||||
//namespace variant { struct Variant; }
|
||||
|
||||
template<typename IO, typename T>
|
||||
void io_dispatch_failed(IO &io, T &t)
|
||||
{
|
||||
static_assert(always_false<T>::value, "io_ or (io_w and io_r) must be defined for non trivial types");
|
||||
}
|
||||
|
||||
template<typename IO, typename T>
|
||||
void io_(IO &io, T &t)
|
||||
{
|
||||
io.on_dispatch_any(t);
|
||||
}
|
||||
|
||||
template<typename IO, typename T>
|
||||
void io_w(IO &io, const T &t)
|
||||
{
|
||||
io_(io, const_cast<T &>(t));
|
||||
}
|
||||
|
||||
template<typename IO, typename T>
|
||||
void io_w_(IO &io, const T &t)
|
||||
{
|
||||
io_w(io, t);
|
||||
}
|
||||
|
||||
template<typename IO, typename T>
|
||||
void io_r(IO &io, T &t)
|
||||
{
|
||||
io_(io, t);
|
||||
}
|
||||
|
||||
template<typename IO, typename T>
|
||||
void io_r_(IO &io, T &t)
|
||||
{
|
||||
io_r(io, t);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user