CppND-Route-Planning-Project | C Route Planning Project based A * search algorithm | Map library
kandi X-RAY | CppND-Route-Planning-Project Summary
kandi X-RAY | CppND-Route-Planning-Project Summary
C++ Route Planning Project based on A* search algorithm on OpenStreetMap
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CppND-Route-Planning-Project
CppND-Route-Planning-Project Key Features
CppND-Route-Planning-Project Examples and Code Snippets
Community Discussions
Trending Discussions on CppND-Route-Planning-Project
QUESTION
I am relatively new to C++ language and trying to implement sort function from algorithm library defined in standard namespace and use std::sort directly. The common structure to sort a vector using sort is given using iterator and comparison function.
Consider vector v as {4,3,5,9}
and after sorting it will look like {9,5,4,3}.
For an instance
ANSWER
Answered 2020-May-26 at 01:51Ok, so much not right here.
The third parameter to std::sort
is a "callable" (think like a function pointer), which std::sort
calls to compare two elements in the sequence. It needs to take two elements of the sequence (usually by const &
and return a bool.
Your example std::sort(v.begin(),v.end(),a>b)
will not work, because a>b
is not callable.
Your "real" code suffers from the same problem.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CppND-Route-Planning-Project
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page