Skip to content

Compiling with clang++ shows unused lambda capture errors #509

@ai-mannamalai

Description

@ai-mannamalai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:HighPriority Label for high priority issuecoresomething about coreenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions