![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/thread-self/root/usr/include/boost/polygon/detail/ |
Upload File : |
/* Copyright 2008 Intel Corporation Use, modification and distribution are subject to 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). */ #ifndef BOOST_POLYGON_ITERATOR_COMPACT_TO_POINTS_HPP #define BOOST_POLYGON_ITERATOR_COMPACT_TO_POINTS_HPP namespace boost { namespace polygon{ template <typename iterator_type, typename point_type> class iterator_compact_to_points { private: iterator_type iter_; iterator_type iter_end_; point_type pt_; typename point_traits<point_type>::coordinate_type firstX_; orientation_2d orient_; public: typedef std::forward_iterator_tag iterator_category; typedef point_type value_type; typedef std::ptrdiff_t difference_type; typedef const point_type* pointer; //immutable typedef const point_type& reference; //immutable inline iterator_compact_to_points() : iter_(), iter_end_(), pt_(), firstX_(), orient_() {} inline iterator_compact_to_points(iterator_type iter, iterator_type iter_end) : iter_(iter), iter_end_(iter_end), pt_(), firstX_(), orient_(HORIZONTAL) { if(iter_ != iter_end_) { firstX_ = *iter_; x(pt_, firstX_); ++iter_; if(iter_ != iter_end_) { y(pt_, *iter_); } } } //use bitwise copy and assign provided by the compiler inline iterator_compact_to_points& operator++() { iterator_type prev_iter = iter_; ++iter_; if(iter_ == iter_end_) { if(x(pt_) != firstX_) { iter_ = prev_iter; x(pt_, firstX_); } } else { set(pt_, orient_, *iter_); orient_.turn_90(); } return *this; } inline const iterator_compact_to_points operator++(int) { iterator_compact_to_points tmp(*this); ++(*this); return tmp; } inline bool operator==(const iterator_compact_to_points& that) const { if (iter_ == iter_end_) { return iter_ == that.iter_; } return (iter_ == that.iter_) && (x(pt_) == x(that.pt_)); } inline bool operator!=(const iterator_compact_to_points& that) const { if (iter_ == iter_end_) { return iter_ != that.iter_; } return (iter_ != that.iter_) || (x(pt_) != x(that.pt_)); } inline reference operator*() const { return pt_; } }; } } #endif