/*! * \file /utl/impl/concepts/iterators.h * \brief utl iterator concept support header * * Copyright (C) 2018 Christos Choutouridis * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #ifndef __utl_concepts_iterator_h__ #define __utl_concepts_iterator_h__ #include #include #include /*! * \ingroup concepts * \defgroup iterators */ //! @{ namespace utl { #if CXX_CONCEPTS template _utlConcept WeaklyIncrementable = Semiregular && requires(I i) { { ++i } -> Same&; // not required to be equality preserving i++; // not required to be equality preserving }; #else namespace detail { template using try_ppI = decltype (++(std::declval())); template using try_Ipp = decltype (std::declval()++); } template _utlConcept WeaklyIncrementable = Semiregular && Same<_ref_t, meta::detected_t>> && meta::is_detected>::value; #endif #if CXX_CONCEPTS template _utlConcept DeviceIterator = requires(I i) { { *i } -> auto&&; // Requires: i is dereferenceable } && WeaklyIncrementable; #else #endif } //! @} #endif /* __utl_concepts_iterator_h__ */