Skip to content

Commit 4d02c2b

Browse files
OlekRaymondJustCallMeRay
authored andcommitted
Adds constexpr to some graph types
1 parent 8c0d1db commit 4d02c2b

4 files changed

Lines changed: 5 additions & 12 deletions

File tree

include/CXXGraph/Edge/DirectedWeightedEdge_decl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using unique = std::unique_ptr<T>;
3131
template <typename T>
3232
using shared = std::shared_ptr<T>;
3333

34-
// Foward Declaration
34+
// Forward Declaration
3535
template <typename T>
3636
class UndirectedWeightedEdge;
3737

@@ -70,7 +70,7 @@ class DirectedWeightedEdge : public DirectedEdge<T>, public Weighted {
7070
Weighted::getWeight());
7171
}
7272

73-
friend std::ostream &operator<< (std::ostream &os,
73+
friend std::ostream &operator<< <>(std::ostream &os,
7474
const DirectedWeightedEdge<T> &edge);
7575
};
7676

include/CXXGraph/Edge/DirectedWeightedEdge_impl.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626

2727
namespace CXXGraph {
2828

29-
using std::make_shared;
30-
using std::make_unique;
31-
3229
template <typename T>
3330
DirectedWeightedEdge<T>::DirectedWeightedEdge(const CXXGraph::id_t id,
3431
const Node<T> &node1,

include/CXXGraph/Edge/Weighted_decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Weighted {
3131
constexpr Weighted() noexcept;
3232
constexpr explicit Weighted(const double weight) noexcept;
3333
virtual ~Weighted() noexcept = default;
34-
constexpr double getWeight() const;
34+
constexpr double getWeight() const noexcept;
3535
constexpr void setWeight(const double weight);
3636
};
3737
} // namespace CXXGraph

include/CXXGraph/Edge/Weighted_impl.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@
2626

2727
namespace CXXGraph {
2828

29-
// inline because the implementation of non-template function in header file
3029
constexpr Weighted::Weighted() noexcept : weight(0.0) {}
3130

32-
// inline because the implementation of non-template function in header file
3331
constexpr Weighted::Weighted(const double inputWeight) noexcept
3432
: weight(inputWeight) {}
3533

36-
// inline because the implementation of non-template function in header file
3734
constexpr double Weighted::getWeight() const noexcept { return weight; }
3835

39-
// inline because the implementation of non-template function in header file
40-
constexpr void Weighted::setWeight(const double weight) {
41-
this->weight = weight;
36+
constexpr void Weighted::setWeight(const double inputWeight) {
37+
weight = inputWeight;
4238
}
4339

4440
} // namespace CXXGraph

0 commit comments

Comments
 (0)