Skip to content

Commit

Permalink
Add nodiscard attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed Feb 23, 2024
1 parent edec176 commit 053e4a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/orange/orangeinp/CsgTreeUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void simplify(CsgTree* tree, NodeId start)
/*!
* Convert a node to postfix notation.
*/
std::vector<LocalSurfaceId::size_type>
[[nodiscard]] std::vector<LocalSurfaceId::size_type>
build_postfix(CsgTree const& tree, NodeId n)
{
CELER_EXPECT(n < tree.size());
Expand All @@ -122,7 +122,7 @@ build_postfix(CsgTree const& tree, NodeId n)
/*!
* Convert a node to an infix string expression.
*/
std::string build_infix_string(CsgTree const& tree, NodeId n)
[[nodiscard]] std::string build_infix_string(CsgTree const& tree, NodeId n)
{
CELER_EXPECT(n < tree.size());
std::ostringstream os;
Expand All @@ -140,7 +140,7 @@ std::string build_infix_string(CsgTree const& tree, NodeId n)
* Thanks to the CSG tree's deduplication, each surface should appear in the
* tree at most once.
*/
std::vector<LocalSurfaceId> calc_surfaces(CsgTree const& tree)
[[nodiscard]] std::vector<LocalSurfaceId> calc_surfaces(CsgTree const& tree)
{
std::vector<LocalSurfaceId> result;
for (auto node_id : range(NodeId{tree.size()}))
Expand Down
7 changes: 4 additions & 3 deletions src/orange/orangeinp/CsgTreeUtils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ orangeinp::NodeId simplify_up(CsgTree* tree, orangeinp::NodeId start);
void simplify(CsgTree* tree, orangeinp::NodeId start);

// Convert a node to postfix notation
std::vector<LocalSurfaceId::size_type>
[[nodiscard]] std::vector<LocalSurfaceId::size_type>
build_postfix(CsgTree const& tree, orangeinp::NodeId n);

// Transform a CSG node into a string expression
std::string build_infix_string(CsgTree const& tree, orangeinp::NodeId n);
[[nodiscard]] std::string
build_infix_string(CsgTree const& tree, orangeinp::NodeId n);

// Get the set of unsimplified surfaces in a tree
std::vector<LocalSurfaceId> calc_surfaces(CsgTree const& tree);
[[nodiscard]] std::vector<LocalSurfaceId> calc_surfaces(CsgTree const& tree);

//---------------------------------------------------------------------------//
} // namespace orangeinp
Expand Down

0 comments on commit 053e4a1

Please sign in to comment.