From: Mikko Rasa Date: Tue, 3 Jan 2023 13:29:58 +0000 (+0200) Subject: Move Memory constructors to the .cpp file X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=34efed1510d68f8258c3b9db37a9f55dcb1eeda9;p=libs%2Fcore.git Move Memory constructors to the .cpp file It's causing an undefined reference to vftable if they're in the header. --- diff --git a/source/io/memory.cpp b/source/io/memory.cpp index 19629c4..0539fdb 100644 --- a/source/io/memory.cpp +++ b/source/io/memory.cpp @@ -9,14 +9,26 @@ using namespace std; namespace Msp { namespace IO { -Memory::Memory(char *b, char *e, Mode m) +Memory::Memory(char *d, std::size_t s, Mode m): + Memory(d, d+s, m) +{ } + +Memory::Memory(char *b, char *e, Mode m): + begin(b), + end(e), + pos(begin) { - begin = b; - end = e; - pos = begin; mode = m; } +Memory::Memory(const char *d, std::size_t s): + Memory(const_cast(d), const_cast(d+s), M_READ) +{ } + +Memory::Memory(const char *b, const char *e): + Memory(const_cast(b), const_cast(e), M_READ) +{ } + void Memory::set_block(bool) { throw unsupported("Memory::set_block"); diff --git a/source/io/memory.h b/source/io/memory.h index 5ae2a34..e009cfd 100644 --- a/source/io/memory.h +++ b/source/io/memory.h @@ -15,10 +15,10 @@ private: char *pos = nullptr; public: - Memory(char *d, std::size_t s, Mode m = M_RDWR): Memory(d, d+s, m) { } + Memory(char *d, std::size_t s, Mode m = M_RDWR); Memory(char *, char *, Mode = M_RDWR); - Memory(const char *d, std::size_t s): Memory(const_cast(d), const_cast(d+s), M_READ) { } - Memory(const char *b, const char *e): Memory(const_cast(b), const_cast(e), M_READ) { } + Memory(const char *d, std::size_t s); + Memory(const char *b, const char *e); void set_block(bool) override; void set_inherit(bool) override;