Skip to content
Snippets Groups Projects
Commit 2438d45f authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #24322. Ref = Value Type on iterator_facade

parent cc837c57
No related merge requests found
......@@ -20,9 +20,9 @@ via a random access iterator.
*/
template <typename T, template <typename> class InfoItem>
class InfoIteratorBase
: public boost::iterator_facade<InfoIteratorBase<T, InfoItem>,
InfoItem<T> &,
boost::random_access_traversal_tag> {
: public boost::iterator_facade<InfoIteratorBase<T, InfoItem>, InfoItem<T>,
boost::random_access_traversal_tag,
InfoItem<T>> {
public:
InfoIteratorBase(T &info, const size_t index) : m_item(info, index) {}
......@@ -59,14 +59,14 @@ private:
return getIndex() == other.getIndex();
}
InfoItem<T> &dereference() const { return m_item; }
InfoItem<T> dereference() const { return m_item; }
uint64_t distance_to(const InfoIteratorBase<T, InfoItem> &other) const {
return static_cast<uint64_t>(other.getIndex()) -
static_cast<uint64_t>(getIndex());
}
mutable InfoItem<T> m_item;
InfoItem<T> m_item;
};
} // namespace Geometry
} // namespace Mantid
......
......@@ -33,7 +33,7 @@ public:
: m_begin(detectorInfo.begin()), m_end(detectorInfo.end()),
m_firstOrDone(true) {}
const ComponentInfoItem<ComponentInfo> &next() {
ComponentInfoItem<ComponentInfo> next() {
if (!m_firstOrDone)
++m_begin;
else
......
......@@ -42,7 +42,7 @@ public:
: m_begin(detectorInfo.begin()), m_end(detectorInfo.end()),
m_firstOrDone(true) {}
const DetectorInfoItem<DetectorInfo> &next() {
DetectorInfoItem<DetectorInfo> next() {
if (!m_firstOrDone)
++m_begin;
else
......
......@@ -5,9 +5,8 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidPythonInterface/api/ComponentInfoPythonIterator.h"
#include "MantidPythonInterface/core/VersionCompat.h"
#include <boost/python/class.hpp>
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/iterator.hpp>
#include <boost/python/module.hpp>
......@@ -23,8 +22,7 @@ void export_ComponentInfoPythonIterator() {
#ifdef IS_PY3K
.def("__next__", &ComponentInfoPythonIterator::next)
#else
.def("next", &ComponentInfoPythonIterator::next,
return_value_policy<copy_const_reference>())
.def("next", &ComponentInfoPythonIterator::next)
#endif
;
/*
......
......@@ -7,7 +7,6 @@
#include "MantidPythonInterface/api/DetectorInfoPythonIterator.h"
#include "MantidPythonInterface/core/VersionCompat.h"
#include <boost/python/class.hpp>
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/iterator.hpp>
#include <boost/python/module.hpp>
......@@ -23,8 +22,7 @@ void export_DetectorInfoPythonIterator() {
#ifdef IS_PY3K
.def("__next__", &DetectorInfoPythonIterator::next)
#else
.def("next", &DetectorInfoPythonIterator::next,
return_value_policy<copy_const_reference>())
.def("next", &DetectorInfoPythonIterator::next)
#endif
;
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment