⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 concepts.hpp

📁 CGAL is a collaborative effort of several sites in Europe and Israel. The goal is to make the most i
💻 HPP
📖 第 1 页 / 共 5 页
字号:
////  Copyright (c) 2000-2002//  Joerg Walter, Mathias Koch////  Permission to use, copy, modify, distribute and sell this software//  and its documentation for any purpose is hereby granted without fee,//  provided that the above copyright notice appear in all copies and//  that both that copyright notice and this permission notice appear//  in supporting documentation.  The authors make no representations//  about the suitability of this software for any purpose.//  It is provided "as is" without express or implied warranty.////  The authors gratefully acknowledge the support of//  GeNeSys mbH & Co. KG in producing this work.//#ifndef BOOST_UBLAS_CONCEPTS_H#define BOOST_UBLAS_CONCEPTS_H#include <boost/concept_check.hpp>// #define INTERNAL_STORAGE// #define INTERNAL_STORAGE_SPARSE// #define INTERNAL_VECTOR// #define INTERNAL_VECTOR_PROXY// #define INTERNAL_VECTOR_SPARSE// #define INTERNAL_MATRIX// #define INTERNAL_MATRIX_PROXY// #define INTERNAL_BANDED// #define INTERNAL_TRIANGULAR// #define INTERNAL_SYMMETRIC// #define INTERNAL_HERMITIAN// #define INTERNAL_MATRIX_SPARSE// #define INTERNAL_VECTOR_EXPRESSION// #define INTERNAL_MATRIX_EXPRESSION// #define EXTERNAL// Concept checks based on ideas of Jeremy Sieknamespace boost { namespace numeric { namespace ublas {    template<class T>    struct AssignableConcept {        typedef T value_type;        static void constraints (value_type t) {            // Copy Constructor            value_type c1 (t);            value_type c2 = t;            // Assignment            value_type a = t;            std::swap (c1, c2);            ignore_unused_variable_warning (a);        }    };    template<class T>    struct EqualityComparableConcept {        typedef T value_type;        static void constraints (const value_type t) {            bool b;            // Equality            b = t == t;            // Inequality            b = t != t;            ignore_unused_variable_warning (b);        }    };    template<class T>    struct LessThanComparableConcept {        typedef T value_type;        static void constraints (const value_type t) {            bool b;            b = t < t;            b = t <= t;            b = t >= t;            b = t > t;            ignore_unused_variable_warning (b);        }    };    template<class T>    struct DefaultConstructibleConcept {        typedef T value_type;        static void constraints () {            // Default Constructor            static value_type c1 = value_type ();            static value_type c2;            ignore_unused_variable_warning (c1);            ignore_unused_variable_warning (c2);        }    };    template<class I, class T = typename std::iterator_traits<I>::value_type>    struct BidirectionalIteratorConcept {        typedef I iterator_type;                typedef typename std::iterator_traits<I>::iterator_category iterator_category;        typedef typename std::iterator_traits<I>::difference_type difference_type;        typedef typename std::iterator_traits<I>::value_type value_type;        typedef typename std::iterator_traits<I>::reference reference;        typedef typename std::iterator_traits<I>::pointer pointer;        static void constraints () {            AssignableConcept<iterator_type>::constraints (iterator_type ());            EqualityComparableConcept<iterator_type>::constraints (iterator_type ());            DefaultConstructibleConcept<iterator_type>::constraints ();            iterator_type it = iterator_type ();            // Associated types - assume constructable            iterator_category c;            difference_type d (0);            pointer p (0);            // Dereference            reference r (*it);            value_type t (r);            // Member access            // FIXME it->m;            // Preincrement            ++ it;            // Postincrement            it ++;            // Predecrement            -- it;            // Postdecrement            it --;            ignore_unused_variable_warning (t);            ignore_unused_variable_warning (c);            ignore_unused_variable_warning (d);            ignore_unused_variable_warning (p);            ignore_unused_variable_warning (r);        }    };    template<class I, class T = typename std::iterator_traits<I>::value_type>    struct MutableBidirectionalIteratorConcept {        typedef I iterator_type;        typedef T value_type;        static void constraints () {            BidirectionalIteratorConcept<iterator_type, value_type>::constraints ();            iterator_type it = iterator_type ();            value_type t = value_type ();            // Dereference assignment            *it = t;            ignore_unused_variable_warning (t);        }    };    template<class I, class D = typename std::iterator_traits<I>::difference_type, class T = typename std::iterator_traits<I>::value_type>    struct RandomAccessIteratorConcept {        typedef I iterator_type;        typedef D difference_type;        typedef T value_type;        static void constraints () {            LessThanComparableConcept<iterator_type>::constraints (iterator_type ());            BidirectionalIteratorConcept<iterator_type, value_type>::constraints ();            iterator_type it = iterator_type (), it1 = iterator_type (), it2 = iterator_type ();            difference_type n (0);            value_type t;            // Forward motion            it += n;            // Iterator addition            it = it + n;            iterator_type itp (it + n);            // Backward motion            it -= n;            // Iterator subtraction            it = it - n;            iterator_type itm (it - n);            // Difference            n = it1 - it2;            // Element operator#ifdef BOOST_UBLAS_ITERATOR_IS_INDEXABLE            t = it [n];#endif            t = *(it + n);            ignore_unused_variable_warning (itp);            ignore_unused_variable_warning (itm);            ignore_unused_variable_warning (t);        }    };    template<class I, class D = typename std::iterator_traits<I>::difference_type, class T = typename std::iterator_traits<I>::value_type>    struct MutableRandomAccessIteratorConcept {        typedef I iterator_type;        typedef D difference_type;        typedef T value_type;        static void constraints () {            MutableBidirectionalIteratorConcept<iterator_type, value_type>::constraints ();            RandomAccessIteratorConcept<iterator_type, difference_type, value_type>::constraints ();            iterator_type it = iterator_type ();            difference_type n (0);            value_type t = value_type ();            // Element assignment#ifdef BOOST_UBLAS_ITERATOR_IS_INDEXABLE            it [n] = t;#endif            *(it + n) = t;        }    };    template<class I>    struct Indexed1DIteratorConcept {        typedef I iterator_type;        static void constraints () {            iterator_type it = iterator_type ();            // Index            it.index ();        }    };    template<class I>    struct IndexedBidirectional1DIteratorConcept {        typedef I iterator_type;        static void constraints () {            BidirectionalIteratorConcept<iterator_type>::constraints ();            Indexed1DIteratorConcept<iterator_type>::constraints ();        }    };    template<class I>    struct MutableIndexedBidirectional1DIteratorConcept {        typedef I iterator_type;        static void constraints () {            MutableBidirectionalIteratorConcept<iterator_type>::constraints ();            Indexed1DIteratorConcept<iterator_type>::constraints ();        }    };    template<class I>    struct IndexedRandomAccess1DIteratorConcept {        typedef I iterator_type;        static void constraints () {            RandomAccessIteratorConcept<iterator_type>::constraints ();            Indexed1DIteratorConcept<iterator_type>::constraints ();        }    };    template<class I>    struct MutableIndexedRandomAccess1DIteratorConcept {        typedef I iterator_type;        static void constraints () {            MutableRandomAccessIteratorConcept<iterator_type>::constraints ();            Indexed1DIteratorConcept<iterator_type>::constraints ();        }    };    template<class I>    struct Indexed2DIteratorConcept {        typedef I iterator_type;        typedef typename I::dual_iterator_type dual_iterator_type;        typedef typename I::dual_reverse_iterator_type dual_reverse_iterator_type;        static void constraints () {            iterator_type it = iterator_type ();            // Indices            it.index1 ();            it.index2 ();            // Iterator begin/end            dual_iterator_type it_begin (it.begin ());            dual_iterator_type it_end (it.end ());            // Reverse iterator begin/end            dual_reverse_iterator_type it_rbegin (it.rbegin ());            dual_reverse_iterator_type it_rend (it.rend ());            ignore_unused_variable_warning (it_begin);            ignore_unused_variable_warning (it_end);            ignore_unused_variable_warning (it_rbegin);            ignore_unused_variable_warning (it_rend);        }    };    template<class I1, class I2>    struct IndexedBidirectional2DIteratorConcept {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -