Changeset 3238 for trunk/test/utility.cc


Ignore:
Timestamp:
May 24, 2014, 12:27:39 PM (9 years ago)
Author:
Peter
Message:

sort_index: add some compile tests, CONCEPT_ASSERTs, and add docs on requirements the compiler tests revealed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/utility.cc

    r3210 r3238  
    511511  if (false) {
    512512    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);
    516544  }
    517545}
Note: See TracChangeset for help on using the changeset viewer.