diff --git a/avogadro/core/angleiterator.cpp b/avogadro/core/angleiterator.cpp index 4dedc5a433..b555ae0e37 100644 --- a/avogadro/core/angleiterator.cpp +++ b/avogadro/core/angleiterator.cpp @@ -16,7 +16,8 @@ using namespace std; AngleIterator::AngleIterator(const Molecule* mol) : m_current(0, 0, 0), m_mol(mol) -{} +{ +} Angle AngleIterator::begin() { @@ -44,15 +45,14 @@ Angle AngleIterator::operator++() if (valid) { // we have a valid current angle, try to find a new edge for (const auto maybeC : graph.neighbors(b)) { - if (maybeC != a - && (!valid || maybeC > c)) { + if (maybeC != a && maybeC > c) { m_current = make_tuple(a, b, maybeC); return m_current; } - } // end "c" loop + } // end "c" loop valid = false; // we couldn't find a "c", so find a new "a" - } // end if() + } // end if() // can we find a new edge? for (const auto maybeA : graph.neighbors(b)) { @@ -67,13 +67,13 @@ Angle AngleIterator::operator++() // if we don't have a valid "a", move out to find a new "b" } while (valid); - while(!valid && b + 1 < count) { + while (!valid && b + 1 < count) { ++b; // try going to the next atom const auto neighbors = graph.neighbors(b); if (neighbors.size() < 2) continue; - + a = neighbors[0]; c = neighbors[0]; // we'll move to the next one in the loop valid = true; @@ -84,4 +84,4 @@ Angle AngleIterator::operator++() return make_tuple(MaxIndex, MaxIndex, MaxIndex); } // end ++ operator -} // namespace Avogadro +} // namespace Avogadro::Core diff --git a/avogadro/core/angleiterator.h b/avogadro/core/angleiterator.h index 3fc7b6dc7e..feed7202fe 100644 --- a/avogadro/core/angleiterator.h +++ b/avogadro/core/angleiterator.h @@ -10,8 +10,8 @@ #include "avogadrocore.h" -#include #include +#include namespace Avogadro { namespace Core { @@ -26,28 +26,25 @@ class AVOGADROCORE_EXPORT AngleIterator /** * Constructor. */ - AngleIterator(const Molecule *mol); + explicit AngleIterator(const Molecule* mol); ~AngleIterator() {} - Angle* operator*() { - return &m_current; - } + Angle* operator*() { return &m_current; } Angle begin(); - Angle end() const { - return std::make_tuple(MaxIndex, MaxIndex, MaxIndex); - } + Angle end() const { return std::make_tuple(MaxIndex, MaxIndex, MaxIndex); } Angle operator++(); - bool operator!=(const AngleIterator& other ) { + bool operator!=(const AngleIterator& other) + { return m_current != other.m_current; } private: - Angle m_current; + Angle m_current; const Molecule* m_mol; }; diff --git a/avogadro/core/array.h b/avogadro/core/array.h index f303c0413a..488261489c 100644 --- a/avogadro/core/array.h +++ b/avogadro/core/array.h @@ -44,15 +44,18 @@ class ArrayRefContainer explicit ArrayRefContainer(const size_t n, const ValueType& value = ValueType()) : m_ref(1), data(n, value) - {} + { + } ArrayRefContainer(const ArrayRefContainer& other) : m_ref(1), data(other.data) - {} + { + } template ArrayRefContainer(InputIterator first, InputIterator last) : m_ref(1), data(first, last) - {} + { + } // Increment the reference count. void reref() { ++m_ref; } @@ -118,11 +121,13 @@ class Array explicit Array(const size_t n, const ValueType& value = ValueType()) : d(new Container(n, value)) - {} + { + } template Array(InputIterator first, InputIterator last) : d(new Container(first, last)) - {} + { + } /** Copy constructor, note the copy made of the internal data of other. */ Array(const Array& other) diff --git a/avogadro/core/variant.h b/avogadro/core/variant.h index 3f171aebfc..f189b535d4 100644 --- a/avogadro/core/variant.h +++ b/avogadro/core/variant.h @@ -46,7 +46,7 @@ class AVOGADROCORE_EXPORT Variant /** Creates a variant to store @p value. */ template - Variant(T value); + explicit Variant(T value); /** Creates a new copy of @p variant. */ inline Variant(const Variant& variant); @@ -130,8 +130,7 @@ class AVOGADROCORE_EXPORT Variant template static T lexical_cast(const std::string& string); -private: - Type m_type; + private : Type m_type; union { bool _bool; @@ -146,8 +145,8 @@ class AVOGADROCORE_EXPORT Variant } m_value; }; -} // end Core namespace -} // end Avogadro namespace +} // namespace Core +} // namespace Avogadro #include "variant-inline.h"