ZigRazor / ZigRazor/CXXGraph

Compiling with clang++ shows unused lambda capture errors

Open
#509 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core enhancement good first issue Priority:High
Dominant language
C++
Stars
729
Forks
147
Avg merge
19h
Merged PRs (30d)
1

Description

Compiling with clang++ shows unused lambda capture errors.

CXXGraph/include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp
@@ -151,15 +151,8 @@ const std::vector<Node<T>> Graph<T>::concurrency_breadth_first_search(
   int block_size = 1;
   int level = 1;
 
-  auto extract_tasks = [&level_tracker, &tracker_mutex, &assigned_tasks,
+  auto extract_tasks = [&assigned_tasks,
                         &num_tasks, &block_size]() -> std::pair<int, int> {
-    /*
-    std::lock_guard<std::mutex> tracker_guard(tracker_mutex);
-    int task_block_size = std::min(num_tasks - assigned_tasks,
-    block_size); std::pair<int,int> task_block{assigned_tasks,
-    assigned_tasks + task_block_size}; assigned_tasks += task_block_size;
-    return task_block;
-    */
     int start = assigned_tasks.fetch_add(block_size);
     int end = std::min(num_tasks, start + block_size);
     return {start, end};
CXXGraph/include/CXXGraph/Graph/Algorithm/CycleDetection_impl.hpp
@@ -59,7 +59,7 @@ bool Graph<T>::isCyclicDirectedGraphDFS() const {
                          shared<const Node<T>>)>
           isCyclicDFSHelper;
       isCyclicDFSHelper =
-          [this, &isCyclicDFSHelper](
+          [&isCyclicDFSHelper](
               const std::shared_ptr<AdjacencyMatrix<T>> adjMatrix,
               std::unordered_map<CXXGraph::id_t, nodeStates> &states,
               shared<const Node<T>> node) {
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp
@@ -67,7 +67,7 @@ double Graph<T>::fordFulkersonMaxFlow(const Node<T> &source,
       nodeSet.begin(), nodeSet.end(),
       [&target](auto node) { return node->getUserId() == target.getUserId(); });
 
-  auto bfs_helper = [this, &source_node_ptr, &target_node_ptr, &parent,
+  auto bfs_helper = [&source_node_ptr, &target_node_ptr, &parent,
                      &weightMap]() -> bool {
     std::unordered_map<shared<const Node<T>>, bool, nodeHash<T>> visited;
     std::queue<shared<const Node<T>>> queue;
diff --git a/CXXGraph/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp b/CXXGraph/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp
index 40c162757..f8d362d3c 100644
--- a/CXXGraph/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp
+++ b/CXXGraph/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp
@@ -89,7 +89,7 @@ SCCResult<T> Graph<T>::kosaraju() const {
     visited.clear();
 
     std::function<void(shared<const Node<T>>, SCCResult<T>, int)> dfs_helper1 =
-        [this, &rev, &visited, &dfs_helper1](
+        [&rev, &visited, &dfs_helper1](
             shared<const Node<T>> source, SCCResult<T> result, int sccLabel) {
           // mark the vertex visited
           visited[source->getId()] = true;
CXXGraph/Partitioning/Utility/Globals.hpp
@@ -41,8 +41,8 @@ class Globals {
   const std::string print() const;
 
   // CONSTANT
-  const int SLEEP_LIMIT = 16;  // In microseconds
-  const int PLACES = 4;
+  static constexpr int SLEEP_LIMIT = 16;  // In microseconds
+  static constexpr int PLACES = 4;
 
   int numberOfPartition = 0;  // number of partitions
   // OPTIONAL

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the library with clang++ and inspect the listed algorithm headers and Partitioning/Utility/Globals.hpp. Check each lambda capture and the Globals constants against the compiler diagnostics. Done means clang++ no longer reports unused lambda captures and the constants use the requested static constexpr declarations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.