1
0
forked from Alepha/Alepha

OStream automatic generation for aggregates.

I still have to sort out the extended capabilities system and
implement the ostream_lens system.
This commit is contained in:
2023-10-23 01:50:47 -04:00
parent 23c71c8d27
commit 3a92d2b788
3 changed files with 66 additions and 9 deletions

View File

@ -9,25 +9,22 @@ static_assert( __cplusplus > 2020'00 );
#include <Alepha/auto_comparable.h>
#include <Alepha/IOStreams/OStreamable.h>
namespace
{
template< typename= Alepha::Capabilities< Alepha::auto_comparable, Alepha::IOStreams::IStreamable > >
template< typename= Alepha::Capabilities< Alepha::auto_comparable, Alepha::IOStreams::IStreamable, Alepha::IOStreams::OStreamable > >
struct Agg_core
{
int x;
int y;
int z;
friend std::ostream &
operator << ( std::ostream &os, const Agg_core &agg )
{
return os << "{ " << agg.x << ", " << agg.y << ", " << agg.z << " }";
}
};
using Agg= Agg_core<>;
static_assert( Alepha::Aggregate< Agg > );
static_assert( Alepha::Capability< Agg, Alepha::IOStreams::IStreamable > );
static_assert( Alepha::Capability< Agg, Alepha::IOStreams::OStreamable > );
}