|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73624 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-09 12:10:58
Author: trademark
Date: 2011-08-09 12:10:58 EDT (Tue, 09 Aug 2011)
New Revision: 73624
URL: http://svn.boost.org/trac/boost/changeset/73624
Log:
Policy class aimed to indicate the sense when an algorithm run through a sequence. Example with 1,2,3 : From the rightmost (begin with 3) or from the leftmost (begin with 1).
Added:
sandbox/SOC/2011/checks/boost/checks/iteration_sense.hpp (contents, props changed)
Added: sandbox/SOC/2011/checks/boost/checks/iteration_sense.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/boost/checks/iteration_sense.hpp 2011-08-09 12:10:58 EDT (Tue, 09 Aug 2011)
@@ -0,0 +1,52 @@
+// Boost checks/iteration_sense.hpp header file ------------------------------------//
+// (C) Copyright Pierre Talbot 2011
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_CHECK_ITERATION_SENSE_HPP
+#define BOOST_CHECK_ITERATION_SENSE_HPP
+
+#include <boost/range/reverse_iterator.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/range/const_iterator.hpp>
+#include <boost/range/const_reverse_iterator.hpp>
+
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/rbegin.hpp>
+#include <boost/range/rend.hpp>
+
+struct rightmost
+{
+
+ template <typename seq_range>
+ struct iterator
+ {
+ typedef typename boost::range_const_reverse_iterator<seq_range>::type type ;
+ };
+
+ template <typename seq_range>
+ static typename iterator<seq_range>::type begin(seq_range &sequence) { return boost::rbegin(sequence) ; }
+
+ template <typename seq_range>
+ static typename iterator<seq_range>::type end(seq_range &sequence) { return boost::rend(sequence) ; }
+};
+
+struct leftmost
+{
+ template <typename seq_range>
+ struct iterator
+ {
+ typedef typename boost::range_const_iterator<seq_range>::type type ;
+ };
+
+ template <typename seq_range>
+ static typename iterator<seq_range>::type begin(seq_range &sequence) { return boost::begin(sequence) ; }
+
+ template <typename seq_range>
+ static typename iterator<seq_range>::type end(seq_range &sequence) { return boost::end(sequence) ; }
+};
+
+#endif // BOOST_CHECKS_ITERATION_SENSE_HPP
\ No newline at end of file
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk