- Fixes for Doxygen Layouts
- Changed dynarray indexing to use size_t - Added groups to optional documentation
This commit is contained in:
@@ -151,21 +151,29 @@ struct array
|
||||
|
||||
///
|
||||
/// \returns A pointer to the first element of the array
|
||||
constexpr ValueT* begin() { return elements; }
|
||||
constexpr ValueT* begin() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
///
|
||||
/// \returns A pointer to one after the end of the array
|
||||
constexpr ValueT* end() { return elements + ElemV; }
|
||||
constexpr ValueT* end() {
|
||||
return elements + ElemV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// \returns A const-qualified pointer to the first element of the array
|
||||
constexpr const ValueT* begin() const { return elements; }
|
||||
constexpr const ValueT* begin() const {
|
||||
return elements;
|
||||
}
|
||||
|
||||
///
|
||||
/// \returns A const-qualified pointer to one after the end of the array
|
||||
constexpr const ValueT* end() const { return elements + ElemV; }
|
||||
constexpr const ValueT* end() const {
|
||||
return elements + ElemV;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
@@ -236,8 +236,8 @@ public:
|
||||
/// \brief Array Access Operator
|
||||
/// \param i The index to access
|
||||
/// \returns A reference to the element at index `i`
|
||||
constexpr TypeT& operator[](int i) {
|
||||
assertd(i >= 0 and size_t(i) < _size, "Array Out of Bounds");
|
||||
constexpr TypeT& operator[](size_t i) {
|
||||
assertd(i < _size, "Array Out of Bounds");
|
||||
return _alloc.data()[i];
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ public:
|
||||
/// \brief Array Access Operator (const)
|
||||
/// \param i The index to access
|
||||
/// \returns A const qualified reference to the element at index `i`
|
||||
constexpr const TypeT& operator[](int i) const {
|
||||
assertd(i >= 0 and size_t(i) < _size, "Array Out of Bounds");
|
||||
constexpr const TypeT& operator[](size_t i) const {
|
||||
assertd(i < _size, "Array Out of Bounds");
|
||||
return _alloc.data()[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,19 @@ namespace fennec
|
||||
/// Graphs contain nodes (sometimes called vertices) and connections. Graphs are either directed
|
||||
/// or undirected. This structure allows the creation of both directed and undirected connections. As
|
||||
/// far as what that means; a directed graph means that connections have direction, where there are connections
|
||||
/// that are "to" and "from," rather than "between" which is used in undirected graphs There are .
|
||||
/// that are "to" and "from," rather than "between" which is used in undirected graphs.
|
||||
///
|
||||
/// An undirected graph is connected if there is a path between every pair of nodes in the graph.
|
||||
///
|
||||
/// A directed graph is weakly connected if replacing all of its directed connections with undirected connections would
|
||||
/// produce a connected graph. We will call this "disjointed"
|
||||
///
|
||||
/// A directed graph is semi-connected if there is a directed path p for `u` → `v` *or* `v` → `u` for every
|
||||
/// pair of nodes `u, v`. We will call this "unilateral"
|
||||
///
|
||||
/// A directed graph is strongly-connected if there is a directed path p for `u` → `v` *and* `v` → `u` for every pair
|
||||
/// of nodes `u, v`. We will call this "connected"
|
||||
///
|
||||
/// \tparam NodeT The type associated with each node
|
||||
/// \tparam WeightT The type associated with each connection
|
||||
template<typename NodeT, typename WeightT = nullptr_t>
|
||||
@@ -143,7 +155,7 @@ public:
|
||||
return num_nodes() == 0;
|
||||
}
|
||||
|
||||
// TODO: connected, disjoint
|
||||
// TODO: connected, disjoint, unilateral
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -252,6 +264,9 @@ public:
|
||||
|
||||
///
|
||||
/// \brief Getter for a list of nodes `x` that `node` has a connection to and from `x...` and share the same weight
|
||||
/// "Joined" connections may also be referred to as "undirected." A joined, or undirected, connection may be
|
||||
/// turned into a directed connection by changing the weight object associated with the connection, or by
|
||||
/// removing one of the sub-connections.
|
||||
/// \param node The id of the node
|
||||
/// \returns A list containing all nodes `x` that have symmetric connections with `node`
|
||||
list<size_t> joined(size_t node) {
|
||||
@@ -268,6 +283,18 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief Getter for the internal storage of mapped connections from this node
|
||||
/// Use this when you want to iterate over connections that start from this node.
|
||||
/// \param node The id of the node
|
||||
/// \returns A pointer to a map containing connections mapped from this node
|
||||
const auto* connections(size_t node) {
|
||||
if (empty() || node >= _conn_map.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &_conn_map[node];
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@ public:
|
||||
|
||||
// Constructors ========================================================================================================
|
||||
|
||||
/// \name Constructors & Destructor
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Default Constructor
|
||||
constexpr optional()
|
||||
@@ -116,9 +119,34 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
// Properties ==========================================================================================================
|
||||
|
||||
/// \name Properties
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Implicit Boolean Check, returns `true` when there is a value contained
|
||||
constexpr operator bool() const {
|
||||
return _set;
|
||||
}
|
||||
|
||||
///
|
||||
/// \returns `true` when there is no held value, `false` otherwise.
|
||||
constexpr bool empty() const {
|
||||
return not _set;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
// Assignment Operators ================================================================================================
|
||||
|
||||
/// \name Assignment
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Fundamental Type Assignment
|
||||
/// \param val The value to set with
|
||||
@@ -195,34 +223,13 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief Emplace Assignment
|
||||
/// \val The optional to move
|
||||
template<typename...ArgsT>
|
||||
constexpr T& emplace(ArgsT&&...args) {
|
||||
if (_set) {
|
||||
_val = T(fennec::forward<ArgsT>(args)...);
|
||||
} else {
|
||||
fennec::construct(&_val, fennec::forward<ArgsT>(args)...);
|
||||
_set = true;
|
||||
}
|
||||
return _val;
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief Reset the Optional
|
||||
void reset() {
|
||||
this->operator=(nullopt);
|
||||
}
|
||||
/// @}
|
||||
|
||||
|
||||
// Operators ===========================================================================================================
|
||||
// Access ==============================================================================================================
|
||||
|
||||
///
|
||||
/// \brief Implicit Boolean Check, returns `true` when there is a value contained
|
||||
constexpr operator bool() const {
|
||||
return _set;
|
||||
}
|
||||
/// \name Access
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \returns A pointer to the value, `nullptr` if there is no value
|
||||
@@ -268,6 +275,35 @@ public:
|
||||
return _val;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
// Modifiers ===========================================================================================================
|
||||
|
||||
/// \name Modifiers
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Emplace Assignment
|
||||
/// \val The optional to move
|
||||
template<typename...ArgsT>
|
||||
constexpr T& emplace(ArgsT&&...args) {
|
||||
if (_set) {
|
||||
_val = T(fennec::forward<ArgsT>(args)...);
|
||||
} else {
|
||||
fennec::construct(&_val, fennec::forward<ArgsT>(args)...);
|
||||
_set = true;
|
||||
}
|
||||
return _val;
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief Reset the Optional
|
||||
void reset() {
|
||||
this->operator=(nullopt);
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
/// 2. \ref building-from-source "Building from Source"
|
||||
/// 1. \ref building-from-terminal "Building from Terminal"
|
||||
/// 1. \ref debian "Debian"
|
||||
/// 2. \ref fedora-dnf "Fedora"
|
||||
/// 2. \ref arch "Arch"
|
||||
/// 3. \ref fedora "Fedora"
|
||||
/// 2. \ref building-on-windows "Building on Windows"
|
||||
/// 3. \ref running-the-test-suite "Running the Test Suite"
|
||||
/// 4. \ref usage "Usage"
|
||||
|
||||
Reference in New Issue
Block a user