From cdaeb0f5bf50ae333ad52dc63d2cb95e4d8b5ebd Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 5 Aug 2020 09:16:07 +0200 Subject: [PATCH] initialize without repeating type --- Core/Aggregate/ParticleLayout.h | 2 +- Core/Instrument/OutputData.h | 2 +- Core/Lattice/Lattice.cpp | 2 +- Core/Material/MaterialFactoryFuncs.h | 6 +++--- Core/StandardSamples/LayersWithAbsorptionBuilder.cpp | 2 +- Core/StandardSamples/ParaCrystalBuilder.cpp | 2 +- Core/StandardSamples/ParticleInTheAirBuilder.cpp | 2 +- GUI/coregui/Models/ComponentProxyStrategy.cpp | 2 +- GUI/coregui/Models/SessionItemUtils.cpp | 2 +- GUI/coregui/Views/SampleDesigner/ConnectableView.h | 2 +- Tests/UnitTests/Core/Parameters/ParameterPatternTest.cpp | 2 +- Tests/UnitTests/Core/Sample/LatticeTest.cpp | 2 +- Tests/UnitTests/GUI/TestRealSpaceBuilderUtils.cpp | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Core/Aggregate/ParticleLayout.h b/Core/Aggregate/ParticleLayout.h index 70cd1ecb502..0736f5c4c22 100644 --- a/Core/Aggregate/ParticleLayout.h +++ b/Core/Aggregate/ParticleLayout.h @@ -39,7 +39,7 @@ public: void accept(INodeVisitor* visitor) const final override { visitor->visit(this); } void addParticle(const IAbstractParticle& particle, double abundance = -1.0, - const kvector_t position = kvector_t(), + const kvector_t position = {}, const IRotation& rotation = IdentityRotation()); SafePointerVector<IParticle> particles() const final override; diff --git a/Core/Instrument/OutputData.h b/Core/Instrument/OutputData.h index 258b907d25a..bad3a97cede 100644 --- a/Core/Instrument/OutputData.h +++ b/Core/Instrument/OutputData.h @@ -551,7 +551,7 @@ template <class T> void OutputData<T>::allocate() dims[i] = (int)getAxis(i).size(); } mp_ll_data = new LLData<T>(rank, dims); - T default_value = T(); + T default_value = {}; mp_ll_data->setAll(default_value); delete[] dims; } diff --git a/Core/Lattice/Lattice.cpp b/Core/Lattice/Lattice.cpp index d75ec628561..9e37c51281b 100644 --- a/Core/Lattice/Lattice.cpp +++ b/Core/Lattice/Lattice.cpp @@ -57,7 +57,7 @@ Lattice Lattice::createTransformedLattice(const Transform3D& transform) const kvector_t a1 = transform.transformed(m_a); kvector_t a2 = transform.transformed(m_b); kvector_t a3 = transform.transformed(m_c); - Lattice result = Lattice(a1, a2, a3); + Lattice result = {a1, a2, a3}; if (mp_selection_rule) result.setSelectionRule(*mp_selection_rule); return result; diff --git a/Core/Material/MaterialFactoryFuncs.h b/Core/Material/MaterialFactoryFuncs.h index 7abb7c3c6d6..313b0375245 100644 --- a/Core/Material/MaterialFactoryFuncs.h +++ b/Core/Material/MaterialFactoryFuncs.h @@ -26,7 +26,7 @@ BA_CORE_API_ Material HomogeneousMaterial(); //! @ingroup materials BA_CORE_API_ Material HomogeneousMaterial(const std::string& name, double delta, double beta, - kvector_t magnetization = kvector_t()); + kvector_t magnetization = {}); //! @ingroup materials @@ -37,7 +37,7 @@ BA_CORE_API_ Material HomogeneousMaterial(const std::string& name, double delta, //! With no parameters given, constructs default (vacuum) material with \f$n = 1\f$ and zero //! magnetization. BA_CORE_API_ Material HomogeneousMaterial(const std::string& name, complex_t refractive_index, - kvector_t magnetization = kvector_t()); + kvector_t magnetization = {}); //! @ingroup materials @@ -60,7 +60,7 @@ BA_CORE_API_ Material MaterialBySLD(); //! @param sld_imag: imaginary part of the scattering length density, inverse square angstroms //! @param magnetization: magnetization (in A/m) BA_CORE_API_ Material MaterialBySLD(const std::string& name, double sld_real, double sld_imag, - kvector_t magnetization = kvector_t()); + kvector_t magnetization = {}); #ifndef SWIG diff --git a/Core/StandardSamples/LayersWithAbsorptionBuilder.cpp b/Core/StandardSamples/LayersWithAbsorptionBuilder.cpp index 28aaa503c49..e3864755346 100644 --- a/Core/StandardSamples/LayersWithAbsorptionBuilder.cpp +++ b/Core/StandardSamples/LayersWithAbsorptionBuilder.cpp @@ -85,6 +85,6 @@ size_t LayersWithAbsorptionBuilder::size() FormFactorComponents& LayersWithAbsorptionBuilder::ff_components() { - static FormFactorComponents result = FormFactorComponents(); + static FormFactorComponents result = {}; return result; } diff --git a/Core/StandardSamples/ParaCrystalBuilder.cpp b/Core/StandardSamples/ParaCrystalBuilder.cpp index e3e7eac5a3e..858834c71fe 100644 --- a/Core/StandardSamples/ParaCrystalBuilder.cpp +++ b/Core/StandardSamples/ParaCrystalBuilder.cpp @@ -127,7 +127,7 @@ size_t Basic2DParaCrystalBuilder::size() FTDistribution2DComponents& Basic2DParaCrystalBuilder::pdf_components() { - static FTDistribution2DComponents result = FTDistribution2DComponents(); + static FTDistribution2DComponents result = {}; return result; } diff --git a/Core/StandardSamples/ParticleInTheAirBuilder.cpp b/Core/StandardSamples/ParticleInTheAirBuilder.cpp index b7a9f8470a3..cb93e18b7df 100644 --- a/Core/StandardSamples/ParticleInTheAirBuilder.cpp +++ b/Core/StandardSamples/ParticleInTheAirBuilder.cpp @@ -70,6 +70,6 @@ size_t ParticleInTheAirBuilder::size() FormFactorComponents& ParticleInTheAirBuilder::ff_components() { - static FormFactorComponents result = FormFactorComponents(); + static FormFactorComponents result = {}; return result; } diff --git a/GUI/coregui/Models/ComponentProxyStrategy.cpp b/GUI/coregui/Models/ComponentProxyStrategy.cpp index 302a03356b5..3b5fc91a095 100644 --- a/GUI/coregui/Models/ComponentProxyStrategy.cpp +++ b/GUI/coregui/Models/ComponentProxyStrategy.cpp @@ -29,7 +29,7 @@ void ComponentProxyStrategy::onDataChanged(SessionModel* source, ComponentProxyM bool ComponentProxyStrategy::processSourceIndex(const QModelIndex& index) { - QPersistentModelIndex sourceIndex = QPersistentModelIndex(index); + QPersistentModelIndex sourceIndex = {index}; SessionItem* item = m_source->itemForIndex(index); diff --git a/GUI/coregui/Models/SessionItemUtils.cpp b/GUI/coregui/Models/SessionItemUtils.cpp index 2e639e1a2ae..bde42abeb84 100644 --- a/GUI/coregui/Models/SessionItemUtils.cpp +++ b/GUI/coregui/Models/SessionItemUtils.cpp @@ -28,7 +28,7 @@ namespace { const GroupInfoCatalog& groupInfoCatalog() { - static GroupInfoCatalog s_catalog = GroupInfoCatalog(); + static GroupInfoCatalog s_catalog = {}; return s_catalog; } diff --git a/GUI/coregui/Views/SampleDesigner/ConnectableView.h b/GUI/coregui/Views/SampleDesigner/ConnectableView.h index 99622159375..e0aad083386 100644 --- a/GUI/coregui/Views/SampleDesigner/ConnectableView.h +++ b/GUI/coregui/Views/SampleDesigner/ConnectableView.h @@ -29,7 +29,7 @@ class BA_CORE_API_ ConnectableView : public IView { Q_OBJECT public: - ConnectableView(QGraphicsItem* parent = 0, QRectF rect = QRectF(0, 0, 50, 50)); + ConnectableView(QGraphicsItem* parent = 0, QRectF rect = {0, 0, 50, 50}); virtual ~ConnectableView() {} int type() const { return ViewTypes::ISAMPLE_RECT; } diff --git a/Tests/UnitTests/Core/Parameters/ParameterPatternTest.cpp b/Tests/UnitTests/Core/Parameters/ParameterPatternTest.cpp index 224113a4441..0c6e16ae1e4 100644 --- a/Tests/UnitTests/Core/Parameters/ParameterPatternTest.cpp +++ b/Tests/UnitTests/Core/Parameters/ParameterPatternTest.cpp @@ -57,6 +57,6 @@ TEST_F(ParameterPatternTest, copyTest) EXPECT_EQ("/Desktop/BornAgain/Core/Tests", p3.toStdString()); // calls copy constructor - ParameterPattern p4 = ParameterPattern(p2); + ParameterPattern p4 = {p2}; EXPECT_EQ("/Desktop/BornAgain/Core/Tests", p4.toStdString()); } diff --git a/Tests/UnitTests/Core/Sample/LatticeTest.cpp b/Tests/UnitTests/Core/Sample/LatticeTest.cpp index de9cf801b40..7171def4bc0 100644 --- a/Tests/UnitTests/Core/Sample/LatticeTest.cpp +++ b/Tests/UnitTests/Core/Sample/LatticeTest.cpp @@ -23,7 +23,7 @@ TEST_F(LatticeTest, declarationTest) EXPECT_EQ(a3, l2.getBasisVectorC()); // calls and tests copy constructor - Lattice l3 = Lattice(l2); + Lattice l3 = {l2}; EXPECT_EQ(a1, l3.getBasisVectorA()); EXPECT_EQ(a2, l3.getBasisVectorB()); EXPECT_EQ(a3, l3.getBasisVectorC()); diff --git a/Tests/UnitTests/GUI/TestRealSpaceBuilderUtils.cpp b/Tests/UnitTests/GUI/TestRealSpaceBuilderUtils.cpp index 9dc69a540a8..3cc5ab1a2f9 100644 --- a/Tests/UnitTests/GUI/TestRealSpaceBuilderUtils.cpp +++ b/Tests/UnitTests/GUI/TestRealSpaceBuilderUtils.cpp @@ -86,7 +86,7 @@ TEST_F(TestRealSpaceBuilderUtils, test_Particle3DContainer) EXPECT_EQ(p2.particleType(), "Particle"); EXPECT_FALSE(p2.particle3DBlend(0u)); - Particle3DContainer p3 = Particle3DContainer(p1); + Particle3DContainer p3 = {p1}; EXPECT_EQ(p3.containerSize(), 1u); EXPECT_EQ(p3.cumulativeAbundance(), 1); -- GitLab