On May 5, 2020, at 13:37, David Kastrup <[email protected]> wrote:
>
> What I have ready-to-use is something that stores like an SCM value but
> behaves like a Smob pointer with regard to -> and * usage.
Oh. I believe I have some of that too. Excerpt:
// specialization for pointers
template <class T>
class ly_scm_t<T *>
{
private:
using traits = ly_scm_traits<T *>;
private:
SCM scm_ = SCM_UNDEFINED;
public:
ly_scm_t () = default;
ly_scm_t (const ly_scm_t &) = default;
ly_scm_t &operator = (const ly_scm_t &) = default;
~ly_scm_t () = default;
explicit ly_scm_t (T *v) : scm_ (traits::to_scm (v)) {}
explicit operator bool () const { return traits::has_value (scm_); }
operator T *() const { return traits::to_value (scm_); }
T *operator ->() { return operator T * (); }
// TODO: operator *
};
—
Dan