1
0
forked from Alepha/Alepha

Start using the stream adaptor.

This commit is contained in:
2024-04-04 18:07:41 -04:00
parent a6467772f4
commit 379a2b4dc2

View File

@ -39,15 +39,14 @@ namespace Alepha::Hydrogen::IOStreams ::detail:: OStreamable_m
{ {
const auto decomposed= Alepha::Reflection::tuplizeAggregate( ostreamable ); const auto decomposed= Alepha::Reflection::tuplizeAggregate( ostreamable );
//static_assert( Capability< Agg, exports::OStreamable > ); //static_assert( Capability< Agg, exports::OStreamable > );
auto delim= adaptStream( StartDelimitedList{ []( std::ostream &os ) { os << fieldDelimiter; } }, os );
bool first= true;
// TODO: Consider the lens system here... but the basic use case seems to be for // TODO: Consider the lens system here... but the basic use case seems to be for
// aggregates, so we'll go with this simple case for now... // aggregates, so we'll go with this simple case for now...
tuple_for_each( decomposed ) <=[&]( const auto &element ) tuple_for_each( decomposed ) <=[&]( const auto &element )
{ {
if( not first ) os << fieldDelimiter; os << NextItem << element;
first= false;
os << element;
}; };
return os; return os;
@ -58,4 +57,3 @@ namespace Alepha::Hydrogen::IOStreams::inline exports::inline OStreamable_m
{ {
using namespace detail::OStreamable_m::exports; using namespace detail::OStreamable_m::exports;
} }