From b59e147b3b2210d12d2c92077327a2f63adbb1a4 Mon Sep 17 00:00:00 2001 From: Raoul Gough Date: Thu, 18 Sep 2003 17:33:33 +0000 Subject: [PATCH] Renaming iterator_suite.hpp to more appropriate iterator_traits.hpp [SVN r1560] --- .../python/suite/indexing/iterator_suite.hpp | 149 ------------------ 1 file changed, 149 deletions(-) delete mode 100755 include/boost/python/suite/indexing/iterator_suite.hpp diff --git a/include/boost/python/suite/indexing/iterator_suite.hpp b/include/boost/python/suite/indexing/iterator_suite.hpp deleted file mode 100755 index ed6bffbb..00000000 --- a/include/boost/python/suite/indexing/iterator_suite.hpp +++ /dev/null @@ -1,149 +0,0 @@ -// -*- mode:c++ -*- -// -// Header file iterator_suite.hpp -// -// Copyright (c) 2003 Raoul M. Gough -// -// This material is provided "as is", with absolutely no warranty expressed -// or implied. Any use is at your own risk. -// -// Permission to use or copy this material for any purpose is hereby -// granted without fee, provided the above notices are retained on all -// copies. Permission to modify the material and to distribute modified -// versions is granted, provided the above notices are retained, and a -// notice that the material was modified is included with the above -// copyright notice. -// -// History -// ======= -// 2003/ 8/23 rmg File creation -// -// $Id$ -// - -#ifndef iterator_suite_rmg_20030823_included -#define iterator_suite_rmg_20030823_included - -#include "suite_utils.hpp" - -#include -#include -#include - -namespace indexing { - enum IndexStyle { - index_style_none // No random access (iteration only) - , index_style_nonlinear // Random access by key (no slicing) - , index_style_linear // Random access by integer index (allows slicing) - }; - - ////////////////////////////////////////////////////////////////////////// - // Indexing traits for containers based on iterator pairs - ////////////////////////////////////////////////////////////////////////// - - template - struct input_iterator_traits - { - private: - typedef std::iterator_traits std_traits; - - public: - typedef Iterator iterator; - typedef typename std_traits::value_type value_type; - typedef typename std_traits::reference reference; - typedef typename std_traits::difference_type difference_type; - typedef typename std_traits::difference_type index_type; - typedef value_type key_type; // find, count, ... - - static bool const has_copyable_iter = false; - static bool const is_reversible = false; - static bool const has_mutable_ref = is_mutable_ref::value; - static IndexStyle const index_style = index_style_none; - }; - - template - struct forward_iterator_traits - : public input_iterator_traits - { - static bool const has_copyable_iter = true; - }; - - template - struct bidirectional_iterator_traits - : public forward_iterator_traits - { - static bool const is_reversible = has_mutable_ref; - }; - - template - struct random_access_iterator_traits - : public bidirectional_iterator_traits - { - static IndexStyle const index_style = index_style_linear; - }; - - namespace iterator_detail { - typedef char input_iter_sizer[1]; - typedef char forward_iter_sizer[2]; - typedef char bidirectional_iter_sizer[3]; - typedef char random_access_iter_sizer[4]; - - input_iter_sizer &sizer (std::input_iterator_tag const &); - forward_iter_sizer &sizer (std::forward_iterator_tag const &); - bidirectional_iter_sizer &sizer (std::bidirectional_iterator_tag const &); - random_access_iter_sizer &sizer (std::random_access_iterator_tag const &); - - template struct traits_by_size { }; - - template<> - struct traits_by_size { - template - struct traits { - typedef input_iterator_traits type; - }; - }; - - template<> - struct traits_by_size { - template - struct traits { - typedef forward_iterator_traits type; - }; - }; - - template<> - struct traits_by_size { - template - struct traits { - typedef bidirectional_iterator_traits type; - }; - }; - - template<> - struct traits_by_size { - template - struct traits { - typedef random_access_iterator_traits type; - }; - }; - - template - class traits_by_category { - typedef typename std::iterator_traits::iterator_category - iterator_category; - - static size_t const size = sizeof(sizer(iterator_category())); - - public: - typedef typename traits_by_size::traits::type type; - }; - } - - template - struct iterator_traits - : public iterator_detail::traits_by_category::type - { - }; -} - -#endif // iterator_suite_rmg_20030823_included