From 4af2cd04015a3668a7df072438a0993c7ad4c0e9 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 2 Jan 2026 09:52:16 -0500 Subject: [PATCH] xo-facet: typeseq strongly typed --- include/xo/object2/sequence/ASequence.hpp | 6 ++++-- include/xo/object2/sequence/ISequence_Xfer.hpp | 8 ++++---- src/object2/ISequence_Any.cpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/xo/object2/sequence/ASequence.hpp b/include/xo/object2/sequence/ASequence.hpp index 332e7cf..301d5be 100644 --- a/include/xo/object2/sequence/ASequence.hpp +++ b/include/xo/object2/sequence/ASequence.hpp @@ -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; } /*namespace scm*/ } /*namespace xo*/ -/* */ \ No newline at end of file +/* */ diff --git a/include/xo/object2/sequence/ISequence_Xfer.hpp b/include/xo/object2/sequence/ISequence_Xfer.hpp index 18a5a61..4a679b6 100644 --- a/include/xo/object2/sequence/ISequence_Xfer.hpp +++ b/include/xo/object2/sequence/ISequence_Xfer.hpp @@ -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 - int32_t + xo::facet::typeseq ISequence_Xfer::s_typeseq = xo::facet::typeseq::id(); @@ -82,4 +82,4 @@ namespace scm { } /*namespace scm */ } /*namespace xo*/ -/* end ISequence_Xfer.hpp */ \ No newline at end of file +/* end ISequence_Xfer.hpp */ diff --git a/src/object2/ISequence_Any.cpp b/src/object2/ISequence_Any.cpp index 9eabc9c..a7781e9 100644 --- a/src/object2/ISequence_Any.cpp +++ b/src/object2/ISequence_Any.cpp @@ -25,7 +25,7 @@ ISequence_Any::_fatal() std::terminate(); } -int32_t +typeseq ISequence_Any::s_typeseq = typeseq::id(); bool