Changeset 3238
- Timestamp:
- May 24, 2014, 12:27:39 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/utility.cc
r3210 r3238 511 511 if (false) { 512 512 std::vector<size_t> vec; 513 utility::sort_index(boost::forward_iterator_archetype<double>(), 514 boost::forward_iterator_archetype<double>(), 515 vec); 513 // value type must be possible to store in a vector so has to be 514 // default constructible and assignable 515 typedef boost::default_constructible_archetype< 516 boost::sgi_assignable_archetype< 517 boost::less_than_comparable_archetype<> > > value_type; 518 boost::input_iterator_archetype<value_type> iter; 519 utility::sort_index(iter, iter, vec); 520 // try with a random access container as well 521 std::vector<value_type> vec2; 522 utility::sort_index(vec2.begin(), vec2.end(), vec); 523 } 524 // same thing with four argument version 525 if (false) { 526 std::vector<size_t> vec; 527 // value type must be possible to store in a vector so has to be 528 // default constructible and assignable 529 typedef boost::default_constructible_archetype< 530 boost::sgi_assignable_archetype<> > value_type; 531 532 boost::input_iterator_archetype<value_type> iter; 533 534 // Create a binary predicate that is assignable and default constructible 535 boost::default_constructible_archetype< 536 boost::sgi_assignable_archetype< 537 boost::binary_predicate_archetype< 538 value_type, value_type> > > comp; 539 540 utility::sort_index(iter, iter, vec, comp); 541 // try with a random access container as well 542 std::vector<value_type> vec2; 543 utility::sort_index(vec2.begin(), vec2.end(), vec, comp); 516 544 } 517 545 } -
trunk/yat/utility/sort_index.h
r3237 r3238 49 49 <a href=http://www.sgi.com/tech/stl/LessThanComparable.html> 50 50 LessThan Comparable</a> 51 - \c InputIterator::value_type is 52 <a href=http://www.sgi.com/tech/stl/DefaultConstructible.html> 53 Default Constructible</a> and 54 <a href=http://www.sgi.com/tech/stl/Assignable.html> 55 Assignable</a> 51 56 52 57 \since New in yat 0.5. In versions prior 0.13 function was restricted to 53 \forward_iterator and \c value_type of\c double.58 \forward_iterator with \c value_type convertible to \c double. 54 59 */ 55 60 template<typename InputIterator> … … 66 71 <a href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html"> 67 72 Strict Weak Ordering</a> 73 - \c Compare is 74 <a href="http://www.sgi.com/tech/stl/Assignable.html"> 75 Assignable</a> 76 - \c InputIterator::value_type is 77 <a href=http://www.sgi.com/tech/stl/DefaultConstructible.html> 78 Default Constructible</a> and 79 <a href=http://www.sgi.com/tech/stl/Assignable.html> 80 Assignable</a> 68 81 - \c InputIterator::value_type is convertible to \c Compare's 69 82 argument type … … 121 134 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>)); 122 135 typedef typename std::iterator_traits<InputIterator>::value_type T; 136 BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<T>)); 137 BOOST_CONCEPT_ASSERT((boost::SGIAssignable<T>)); 123 138 BOOST_CONCEPT_ASSERT((boost::LessThanComparable<T>)); 124 139 sort_index(first, last, idx, std::less<T>()); … … 131 146 { 132 147 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>)); 133 134 148 typedef typename std::iterator_traits<InputIterator> traits; 149 typedef typename std::iterator_traits<InputIterator>::value_type T; 150 BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<T>)); 151 BOOST_CONCEPT_ASSERT((boost::SGIAssignable<T>)); 152 BOOST_CONCEPT_ASSERT((boost::Assignable<Compare>)); 153 135 154 typedef typename traits::iterator_category category; 136 155 detail::sort_index(first, last, idx, comp, category());
Note: See TracChangeset
for help on using the changeset viewer.