Changeset 1526


Ignore:
Timestamp:
Oct 2, 2012, 12:35:15 PM (9 years ago)
Author:
Peter Johansson
Message:

latest yat

Location:
trunk/yat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/CommandLine.cc

    r1463 r1526  
    1 // $Id: CommandLine.cc 2609 2011-11-02 00:18:24Z peter $
     1// $Id: CommandLine.cc 2853 2012-09-23 23:56:38Z peter $
    22
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009, 2010, 2011 Peter Johansson
     6  Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    176176        iter->second->parse(arg, last);
    177177    }           
    178     else if (iter==long_options_.end()) {
     178    if (iter==long_options_.end()) {
    179179      std::stringstream ss3;
    180180      ss3 << "unrecognized option `" << key << "'\n" << try_help();
  • trunk/yat/stl_utility.h

    r1498 r1526  
    439439
    440440  /**
     441     Create a map mapping from values in range [first, last) to the
     442     distance from first.
     443
     444     Post-condition: m[first[i]] == i (for all i that correspond to a
     445     unique element). For non-unique element behaviour is undefined.
     446
     447     Requirement: InputIterator's value type is assignable to Key
     448
     449     \since New in yat 0.10
     450   */
     451  template<typename InputIterator, typename Key, typename Comp>
     452  void inverse(InputIterator first, InputIterator last,
     453               std::map<Key, size_t, Comp >& m)
     454  {
     455    BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>));
     456    BOOST_CONCEPT_ASSERT((boost::Convertible<typename std::iterator_traits<InputIterator>::value_type, Key>));
     457    m.clear();
     458    for (size_t i=0; first!=last; ++i, ++first)
     459      m[*first] = i;
     460  }
     461
     462  /**
    441463     \brief Functor that behaves like std::less with the exception
    442464     that it treates NaN as a number larger than infinity.
Note: See TracChangeset for help on using the changeset viewer.