22     __A__(
const int __i) :
 
   26     friend inline bool operator<(
const __A__& first, 
const __A__& second)
 
   28       return first.i < second.i;
 
   31     friend inline std::ostream& 
operator<<(std::ostream& out, 
const __A__& 
object)
 
   33       return out << 
object.i;
 
   50   void inline print(std::ostream& out, 
int debug, 
const char* 
const message, 
int N, T* p)
 
   57       cout << setw(10) << left << message;
 
   59       for (
int i = 0; i != N; ++i) {
 
   60         out << 
' ' << setw(2) << p[i];
 
   75 int main(
int argc, 
char **argv)
 
   83     JParser<> zap(
"Example program to test selection of ordered data.");
 
   89   catch(
const exception &error) {
 
   90     FATAL(error.what() << endl);
 
   98   int numberOfElements = 5;
 
  100   for (
int i = 0; i != numberOfElements; ++i) {
 
  101     buffer.push_back(__A__(i));
 
  104   print(cout, 
debug, 
"original:", numberOfElements, buffer.data());
 
  106   for (
int index = 0; index != numberOfElements -1; ++ index) {
 
  108     buffer[index].i += 1;
 
  110     print(cout, 
debug, 
"before:", numberOfElements, buffer.data());
 
  114     print(cout, 
debug, 
"after:", N, buffer.data());
 
  116     ASSERT(N == numberOfElements - 1);
 
  118     for (
int i = 0; i != index; ++i) {
 
  122     for (
int i = index; i != N; ++i) {
 
  123       ASSERT(buffer[i].i == i+1);
 
  128     sort(buffer.begin(), buffer.end());
 
  132     const int index = numberOfElements - 1;
 
  134     buffer[index].i += 1;
 
  136     print(cout, 
debug, 
"before:", numberOfElements, buffer.data());
 
  140     print(cout, 
debug, 
"after:", N, buffer.data());
 
  142     ASSERT(N == numberOfElements);
 
  144     buffer[index].i = index;
 
  150     buffer[index].i -= 1;
 
  152     print(cout, 
debug, 
"before:", numberOfElements, buffer.data());
 
  156     print(cout, 
debug, 
"after:", N, buffer.data());
 
  158     ASSERT(N == numberOfElements);
 
  160     buffer[index].i = index;
 
  163   for (
int index = 1; index != numberOfElements; ++ index) {
 
  165     buffer[index].i -= 1;
 
  167     print(cout, 
debug, 
"before:", numberOfElements, buffer.data());
 
  171     print(cout, 
debug, 
"after:", N, buffer.data());
 
  173     ASSERT(N == numberOfElements - 1);
 
  175     for (
int i = 0; i != index; ++i) {
 
  179     for (
int i = index; i != N; ++i) {
 
  180       ASSERT(buffer[i].i == i+1);
 
  185     sort(buffer.begin(), buffer.end());
 
General purpose messaging.
 
#define ASSERT(A,...)
Assert macro.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
int main(int argc, char **argv)
 
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
 
Utility class to parse command line options.
 
bool operator<(const Head &first, const Head &second)
Less than operator.
 
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
 
T make_set(T __begin, T __end, JResult_t std::iterator_traits< T >::value_type::*value, const JComparator_t &comparator)
Method to exclude outliers from already sorted data.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).