xo-facet: typeseq strongly typed

This commit is contained in:
Roland Conybeare 2026-01-02 09:52:16 -05:00
commit fb14fcad15
31 changed files with 151 additions and 72 deletions

View file

@ -34,6 +34,8 @@ public:
/** @defgroup scm-sequence-type-traits **/
///@{
// types
/** integer identifying a type **/
using typeseq = xo::facet::typeseq;
/** type for length of a sequence **/
using size_type = std::size_t;
/** facet for types with GC support **/
@ -44,7 +46,7 @@ public:
///@{
// const methods
/** RTTI: unique id# for actual runtime data representation **/
virtual int32_t _typeseq() const noexcept = 0;
virtual typeseq _typeseq() const noexcept = 0;
/** true iff sequence is empty **/
virtual bool is_empty(Copaque data) const noexcept = 0;
/** true iff sequence is finite **/
@ -72,4 +74,4 @@ using ISequence_ImplType = xo::facet::FacetImplType<ASequence, DRepr>;
} /*namespace scm*/
} /*namespace xo*/
/* */
/* */

View file

@ -38,7 +38,7 @@ namespace scm {
// from ASequence
// const methods
int32_t _typeseq() const noexcept override { return s_typeseq; }
typeseq _typeseq() const noexcept override { return s_typeseq; }
bool is_empty(Copaque data) const noexcept override {
return I::is_empty(_dcast(data));
}
@ -61,7 +61,7 @@ namespace scm {
///@{
/** typeseq for template parameter DRepr **/
static int32_t s_typeseq;
static typeseq s_typeseq;
/** true iff satisfies facet implementation **/
static bool _valid;
@ -69,7 +69,7 @@ namespace scm {
};
template <typename DRepr, typename ISequence_DRepr>
int32_t
xo::facet::typeseq
ISequence_Xfer<DRepr, ISequence_DRepr>::s_typeseq
= xo::facet::typeseq::id<DRepr>();
@ -82,4 +82,4 @@ namespace scm {
} /*namespace scm */
} /*namespace xo*/
/* end ISequence_Xfer.hpp */
/* end ISequence_Xfer.hpp */