Fix mis-application of std:prev on slot ptr
The std::prev() call on gr_slot_linebreak_before was operating on the pointer type not converting to the iterator
type.
Undefined template specialisations of std::{next,prev} for gr_slot* & gr_slot const * have been declared, an these will cause compilation errors on future accidental
use.
diff --git a/src/gr_slot.cpp b/src/gr_slot.cpp
index 1203eb8..a8933d3 100644
--- a/src/gr_slot.cpp
+++ b/src/gr_slot.cpp
@@ -159,7 +159,7 @@
void gr_slot_linebreak_before(gr_slot* p/*not NULL*/)
{
assert(p);
- gr_slot *prev = static_cast<gr_slot *>(std::prev(p));
+ gr_slot *prev = static_cast<gr_slot *>(p->prev());
prev->sibling(nullptr);
prev->next(nullptr);
p->prev(nullptr);
diff --git a/src/inc/Main.h b/src/inc/Main.h
index ebf02dd..9a37ec9 100644
--- a/src/inc/Main.h
+++ b/src/inc/Main.h
@@ -193,6 +193,16 @@
#define GR_FALLTHROUGH /* fallthrough */
#endif
+
+// TODO: Remove these sepcialisations once full refactor of SlotBuffer and iterators is done.
+#include <iterator>
+class gr_slot;
+
+template<> gr_slot * std::prev<gr_slot*>(gr_slot *, ptrdiff_t);
+template<> gr_slot const * std::prev<gr_slot const*>(gr_slot const *, ptrdiff_t);
+template<> gr_slot * std::next<gr_slot*>(gr_slot *, ptrdiff_t);
+template<> gr_slot const * std::next<gr_slot const*>(gr_slot const *, ptrdiff_t);
+
#ifdef _MSC_VER
#pragma warning(disable: 4800)
#pragma warning(disable: 4355)