refactor ContainerUtil into container.hpp
This commit is contained in:
parent
67a8d30e87
commit
f2b72113c1
@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "BasicRoutingInterface.h"
|
#include "BasicRoutingInterface.h"
|
||||||
#include "../DataStructures/Range.h"
|
#include "../DataStructures/Range.h"
|
||||||
#include "../DataStructures/SearchEngineData.h"
|
#include "../DataStructures/SearchEngineData.h"
|
||||||
|
#include "../Util/container.hpp"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
@ -172,7 +173,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_unique_resize(via_node_candidate_list);
|
osrm::sort_unique_resize(via_node_candidate_list);
|
||||||
|
|
||||||
std::vector<NodeID> packed_forward_path;
|
std::vector<NodeID> packed_forward_path;
|
||||||
std::vector<NodeID> packed_reverse_path;
|
std::vector<NodeID> packed_reverse_path;
|
||||||
|
@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "../DataStructures/RawRouteData.h"
|
#include "../DataStructures/RawRouteData.h"
|
||||||
#include "../DataStructures/SearchEngineData.h"
|
#include "../DataStructures/SearchEngineData.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
#include "../Util/ContainerUtils.h"
|
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
@ -25,12 +25,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONTAINERUTILS_H_
|
#ifndef CONTAINER_HPP_
|
||||||
#define CONTAINERUTILS_H_
|
#define CONTAINER_HPP_
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iterator>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace osrm
|
||||||
|
{
|
||||||
template <typename T> void sort_unique_resize(std::vector<T> &vector)
|
template <typename T> void sort_unique_resize(std::vector<T> &vector)
|
||||||
{
|
{
|
||||||
std::sort(vector.begin(), vector.end());
|
std::sort(vector.begin(), vector.end());
|
||||||
@ -58,15 +61,15 @@ Function for_each_pair(ForwardIterator begin, ForwardIterator end, Function func
|
|||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
ForwardIterator next = begin;
|
auto next = begin;
|
||||||
++next;
|
next = std::next(next);
|
||||||
|
|
||||||
while (next != end)
|
while (next != end)
|
||||||
{
|
{
|
||||||
function(*begin, *next);
|
function(*begin, *next);
|
||||||
++begin; ++next;
|
std::next(begin); std::next(next);
|
||||||
}
|
}
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* CONTAINERUTILS_H_ */
|
#endif /* CONTAINER_HPP_ */
|
Loading…
Reference in New Issue
Block a user