Skip to content
Snippets Groups Projects
Commit 75f47135 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

OwningVector + move c'tor; DWBAComputation + OwningVector

parent a42ed471
No related branches found
No related tags found
1 merge request!1017consequential use of OwningVector
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
for (T* e : other) for (T* e : other)
m_v.emplace_back(e->clone()); m_v.emplace_back(e->clone());
} }
OwningVector(OwningVector&& other) = default;
~OwningVector() { clear(); } ~OwningVector() { clear(); }
OwningVector& operator=(const OwningVector& other) OwningVector& operator=(const OwningVector& other)
{ {
...@@ -58,6 +59,7 @@ public: ...@@ -58,6 +59,7 @@ public:
std::swap(m_v, ret.m_v); std::swap(m_v, ret.m_v);
return *this; return *this;
} }
OwningVector& operator=(OwningVector&& other) = default;
void emplace_back(T* e) { m_v.emplace_back(e); } void emplace_back(T* e) { m_v.emplace_back(e); }
void clear() void clear()
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
namespace { namespace {
std::vector<std::unique_ptr<const ParticleLayoutContribution>> OwningVector<const ParticleLayoutContribution>
makeLayoutComputation(const std::vector<reLayout>& layouts, const SimulationOptions& options, makeLayoutComputation(const std::vector<reLayout>& layouts, const SimulationOptions& options,
bool polarized) bool polarized)
{ {
std::vector<std::unique_ptr<const ParticleLayoutContribution>> result; OwningVector<const ParticleLayoutContribution> result;
for (const reLayout& layout : layouts) for (const reLayout& layout : layouts)
result.emplace_back(new ParticleLayoutContribution(layout, options, polarized)); result.emplace_back(new ParticleLayoutContribution(layout, options, polarized));
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define BORNAGAIN_SIM_COMPUTATION_DWBACOMPUTATION_H #define BORNAGAIN_SIM_COMPUTATION_DWBACOMPUTATION_H
#include "Sim/Computation/IComputation.h" #include "Sim/Computation/IComputation.h"
#include "Base/Types/OwningVector.h"
#include <vector> #include <vector>
class DiffuseElement; class DiffuseElement;
...@@ -53,7 +54,7 @@ private: ...@@ -53,7 +54,7 @@ private:
std::vector<DiffuseElement>::iterator m_begin_it, m_end_it; std::vector<DiffuseElement>::iterator m_begin_it, m_end_it;
const std::unique_ptr<const GISASSpecularContribution> m_specular_contrib; const std::unique_ptr<const GISASSpecularContribution> m_specular_contrib;
const std::unique_ptr<const RoughMultiLayerContribution> m_roughness_contrib; const std::unique_ptr<const RoughMultiLayerContribution> m_roughness_contrib;
const std::vector<std::unique_ptr<const ParticleLayoutContribution>> m_layout_contribs; const OwningVector<const ParticleLayoutContribution> m_layout_contribs;
}; };
#endif // BORNAGAIN_SIM_COMPUTATION_DWBACOMPUTATION_H #endif // BORNAGAIN_SIM_COMPUTATION_DWBACOMPUTATION_H
......
...@@ -693,6 +693,9 @@ OwningVector::OwningVector ...@@ -693,6 +693,9 @@ OwningVector::OwningVector
Constructor that clones elements in given vector. Constructor that clones elements in given vector.
"; ";
%feature("docstring") OwningVector::OwningVector "OwningVector< T >::OwningVector(OwningVector &&other)=default
OwningVector::OwningVector";
%feature("docstring") OwningVector::~OwningVector "OwningVector< T >::~OwningVector() %feature("docstring") OwningVector::~OwningVector "OwningVector< T >::~OwningVector()
OwningVector::~OwningVector"; OwningVector::~OwningVector";
......
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