[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Almost, but not quite: C++ STL in LilyPond
From: |
Dan Eble |
Subject: |
Re: Almost, but not quite: C++ STL in LilyPond |
Date: |
Tue, 5 May 2020 17:32:22 -0400 |
On May 5, 2020, at 13:37, David Kastrup <address@hidden> 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
- Re: Almost, but not quite: C++ STL in LilyPond, (continued)
- Re: Almost, but not quite: C++ STL in LilyPond, Han-Wen Nienhuys, 2020/05/07
- Re: Almost, but not quite: C++ STL in LilyPond, Jonas Hahnfeld, 2020/05/07
- Re: Almost, but not quite: C++ STL in LilyPond, David Kastrup, 2020/05/07
Re: Almost, but not quite: C++ STL in LilyPond, Hans Åberg, 2020/05/05
Re: Almost, but not quite: C++ STL in LilyPond, Dan Eble, 2020/05/05
- Re: Almost, but not quite: C++ STL in LilyPond, David Kastrup, 2020/05/05
- Re: Almost, but not quite: C++ STL in LilyPond,
Dan Eble <=
- Re: Almost, but not quite: C++ STL in LilyPond, David Kastrup, 2020/05/05
- Re: Almost, but not quite: C++ STL in LilyPond, David Kastrup, 2020/05/05
- Re: Almost, but not quite: C++ STL in LilyPond, Dan Eble, 2020/05/05
- Re: Almost, but not quite: C++ STL in LilyPond, Carl Sorensen, 2020/05/05
- Re: Almost, but not quite: C++ STL in LilyPond, Dan Eble, 2020/05/05