diff options
Diffstat (limited to 'boost/graph/detail/histogram_sort.hpp')
-rw-r--r-- | boost/graph/detail/histogram_sort.hpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/boost/graph/detail/histogram_sort.hpp b/boost/graph/detail/histogram_sort.hpp index ca6266a528..ef03635638 100644 --- a/boost/graph/detail/histogram_sort.hpp +++ b/boost/graph/detail/histogram_sort.hpp @@ -54,7 +54,6 @@ count_starts KeyFilter key_filter, KeyTransform key_transform) { - typedef VerticesSize vertices_size_type; typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; // Put the degree of each vertex v into m_rowstart[v + 1] @@ -69,7 +68,7 @@ count_starts // m_rowstart EdgeIndex start_of_this_row = 0; starts[0] = start_of_this_row; - for (vertices_size_type i = 1; i <= numkeys; ++i) { + for (VerticesSize i = 1; i < numkeys + 1; ++i) { start_of_this_row += starts[i]; starts[i] = start_of_this_row; } @@ -88,7 +87,6 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, KeyFilter key_filter, KeyTransform key_transform) { - typedef NumKeys vertices_size_type; typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; // Histogram sort the edges by their source vertices, putting the targets @@ -99,7 +97,7 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, Value1InputIter v1i = values1_begin; for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i) { if (key_filter(*i)) { - vertices_size_type source = key_transform(*i); + NumKeys source = key_transform(*i); BOOST_ASSERT (source < numkeys); EdgeIndex insert_pos = current_insert_positions[source]; ++current_insert_positions[source]; @@ -126,7 +124,6 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, KeyFilter key_filter, KeyTransform key_transform) { - typedef NumKeys vertices_size_type; typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; // Histogram sort the edges by their source vertices, putting the targets @@ -138,7 +135,7 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, Value2InputIter v2i = values2_begin; for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i, ++v2i) { if (key_filter(*i)) { - vertices_size_type source = key_transform(*i); + NumKeys source = key_transform(*i); BOOST_ASSERT (source < numkeys); EdgeIndex insert_pos = current_insert_positions[source]; ++current_insert_positions[source]; @@ -159,7 +156,6 @@ histogram_sort_inplace(KeyIterator key_begin, Value1Iter values1, KeyTransform key_transform) { - typedef NumKeys vertices_size_type; typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; // 1. Copy m_rowstart (except last element) to get insert positions @@ -194,7 +190,6 @@ histogram_sort_inplace(KeyIterator key_begin, Value2Iter values2, KeyTransform key_transform) { - typedef NumKeys vertices_size_type; typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; // 1. Copy m_rowstart (except last element) to get insert positions @@ -274,16 +269,21 @@ void split_into_separate_coords_filtered } } +// The versions of operator()() here can't return by reference because the +// actual type passed in may not match Pair, in which case the reference +// parameter is bound to a temporary that could end up dangling after the +// operator returns. + template <typename Pair> struct project1st { typedef typename Pair::first_type result_type; - const result_type& operator()(const Pair& p) const {return p.first;} + result_type operator()(const Pair& p) const {return p.first;} }; template <typename Pair> struct project2nd { typedef typename Pair::second_type result_type; - const result_type& operator()(const Pair& p) const {return p.second;} + result_type operator()(const Pair& p) const {return p.second;} }; } |