diff --git a/rak/priority_queue.h b/rak/priority_queue.h index 9edd3f21..9a8b67da 100644 --- a/rak/priority_queue.h +++ b/rak/priority_queue.h @@ -1,39 +1,3 @@ -// rak - Rakshasa's toolbox -// Copyright (C) 2005-2007, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - // priority_queue is a priority queue implemented using a binary // heap. It can contain multiple instances of a value. @@ -85,7 +49,7 @@ public: template iterator find(const Key& key) { - return std::find_if(begin(), end(), std::bind2nd(m_equal, key)); + return std::find_if(begin(), end(), [&](auto& value) { return m_equal(value, key); }); } template @@ -110,36 +74,6 @@ private: Equal m_equal; }; -// Iterate while the top node has higher priority, as 'Compare' -// returns false. -template -class queue_pop_iterator - : public std::iterator { -public: - typedef Queue container_type; - - queue_pop_iterator() : m_queue(NULL) {} - queue_pop_iterator(Queue* q, Compare c) : m_queue(q), m_compare(c) {} - - queue_pop_iterator& operator ++ () { m_queue->pop(); return *this; } - queue_pop_iterator& operator ++ (int) { m_queue->pop(); return *this; } - - typename container_type::const_reference operator * () { return m_queue->top(); } - - bool operator != (const queue_pop_iterator& itr) { return !m_queue->empty() && !m_compare(m_queue->top()); } - bool operator == (const queue_pop_iterator& itr) { return m_queue->empty() || m_compare(m_queue->top()); } - -private: - Queue* m_queue; - Compare m_compare; -}; - -template -inline queue_pop_iterator -queue_popper(Queue& queue, Compare comp) { - return queue_pop_iterator(&queue, comp); -} - } #endif diff --git a/src/command_logging.cc b/src/command_logging.cc index c81762cb..002e8dd5 100644 --- a/src/command_logging.cc +++ b/src/command_logging.cc @@ -32,7 +32,7 @@ torrent::Object apply_log_open(int output_flags, const torrent::Object::list_type& args) { if (args.size() < 2) throw torrent::input_error("Invalid number of arguments."); - + torrent::Object::list_const_iterator itr = args.begin(); std::string output_id = (itr++)->as_string();