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

📄 concepts.hpp

📁 boost库提供标准的C++ API 配合dev c++使用,功能更加强大
💻 HPP
📖 第 1 页 / 共 5 页
字号:
        }
    };

    template<class I1, class I2>
    struct IndexedBidirectional2DIteratorConcept {
        typedef I1 iterator1_type;
        typedef I2 iterator2_type;

        static void constraints () {
            BidirectionalIteratorConcept<iterator1_type>::constraints ();
            BidirectionalIteratorConcept<iterator2_type>::constraints ();
            Indexed2DIteratorConcept<iterator1_type>::constraints ();
            Indexed2DIteratorConcept<iterator2_type>::constraints ();
        }
    };

    template<class I1, class I2>
    struct MutableIndexedBidirectional2DIteratorConcept {
        typedef I1 iterator1_type;
        typedef I2 iterator2_type;

        static void constraints () {
            MutableBidirectionalIteratorConcept<iterator1_type>::constraints ();
            MutableBidirectionalIteratorConcept<iterator2_type>::constraints ();
            Indexed2DIteratorConcept<iterator1_type>::constraints ();
            Indexed2DIteratorConcept<iterator2_type>::constraints ();
        }
    };

    template<class I1, class I2>
    struct IndexedRandomAccess2DIteratorConcept {
        typedef I1 iterator1_type;
        typedef I2 iterator2_type;

        static void constraints () {
            RandomAccessIteratorConcept<iterator1_type>::constraints ();
            RandomAccessIteratorConcept<iterator2_type>::constraints ();
            Indexed2DIteratorConcept<iterator1_type>::constraints ();
            Indexed2DIteratorConcept<iterator2_type>::constraints ();
        }
    };

    template<class I1, class I2>
    struct MutableIndexedRandomAccess2DIteratorConcept {
        typedef I1 iterator1_type;
        typedef I2 iterator2_type;

        static void constraints () {
            MutableRandomAccessIteratorConcept<iterator1_type>::constraints ();
            MutableRandomAccessIteratorConcept<iterator2_type>::constraints ();
            Indexed2DIteratorConcept<iterator1_type>::constraints ();
            Indexed2DIteratorConcept<iterator2_type>::constraints ();
        }
    };

    template<class C>
    struct ContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        typedef typename C::const_iterator const_iterator_type;
        
        static void constraints () {
            DefaultConstructibleConcept<container_type>::constraints ();    
            container_type c = container_type ();
            size_type n (0);
            // Beginning of range
            const_iterator_type cit_begin (c.begin ());
            // End of range
            const_iterator_type cit_end (c.end ());
            // Size
            n = c.size ();
            ignore_unused_variable_warning (cit_end);
            ignore_unused_variable_warning (cit_begin);
            ignore_unused_variable_warning (n);
        }
    };

    template<class C>
    struct MutableContainerConcept {
        typedef C container_type;
        typedef typename C::iterator iterator_type;
        
        static void constraints () {
            AssignableConcept<container_type>::constraints (container_type ());
            ContainerConcept<container_type>::constraints ();
            container_type c = container_type (), c1 = container_type (), c2 = container_type ();
            // Beginning of range
            iterator_type it_begin (c.begin ());
            // End of range
            iterator_type it_end (c.end ());
            // Swap
            c1.swap (c2);
            ignore_unused_variable_warning (it_end);
            ignore_unused_variable_warning (it_begin);
        }
    };

    template<class C>
    struct ReversibleContainerConcept {
        typedef C container_type;
        typedef typename C::const_reverse_iterator const_reverse_iterator_type;

        static void constraints () {
            ContainerConcept<container_type>::constraints ();
#ifndef BOOST_UBLAS_LWG_ISSUE_280
            const container_type cc = container_type ();
#else
            container_type c = container_type ();
#endif
            // Beginning of reverse range
#ifndef BOOST_UBLAS_LWG_ISSUE_280
            const_reverse_iterator_type crit_begin (cc.rbegin ());
#else
            const_reverse_iterator_type crit_begin (c.rbegin ());
#endif
            // End of reverse range
#ifndef BOOST_UBLAS_LWG_ISSUE_280
            const_reverse_iterator_type crit_end (cc.rend ());
#else
            const_reverse_iterator_type crit_end (c.rend ());
#endif
            ignore_unused_variable_warning (crit_end);
            ignore_unused_variable_warning (crit_begin);
        }
    };

    template<class C>
    struct MutableReversibleContainerConcept {
        typedef C container_type;
        typedef typename C::reverse_iterator reverse_iterator_type;
        
        static void constraints () {
            MutableContainerConcept<container_type>::constraints ();
            ReversibleContainerConcept<container_type>::constraints ();
            container_type c = container_type ();
            // Beginning of reverse range
            reverse_iterator_type rit_begin (c.rbegin ());
            // End of reverse range
            reverse_iterator_type rit_end (c.rend ());
            ignore_unused_variable_warning (rit_end);
            ignore_unused_variable_warning (rit_begin);
        }
    };

    template<class C>
    struct RandomAccessContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        typedef typename C::value_type value_type;
        
        static void constraints () {
            ReversibleContainerConcept<container_type>::constraints ();
            container_type c = container_type ();
            size_type n (0);
            value_type t = value_type ();
            // Element access
            t = c [n];
            ignore_unused_variable_warning (t);
        }
    };

    template<class C>
    struct MutableRandomAccessContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        typedef typename C::value_type value_type;
        
        static void constraints () {
            MutableReversibleContainerConcept<container_type>::constraints ();
            RandomAccessContainerConcept<container_type>::constraints ();
            container_type c = container_type ();
            size_type n (0);
            value_type t = value_type ();
            // Element access
            c [n] = t;
        }
    };

    template<class C>
    struct StorageContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        
        static void constraints () {
            RandomAccessContainerConcept<container_type>::constraints ();
            size_type n (0);
            // Sizing constructor
            container_type c = container_type (n);
            ignore_unused_variable_warning (c);
        }
    };

    template<class C>
    struct MutableStorageContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        typedef typename C::value_type value_type;
        typedef typename C::iterator iterator_type;
        
        static void constraints () {
            MutableRandomAccessContainerConcept<container_type>::constraints ();
            size_type n (0);
            // Sizing constructor
            container_type c = container_type (n);
            value_type t = value_type ();
            iterator_type it = iterator_type (), it1 = iterator_type (), it2 = iterator_type ();
            // Insert 
            c.insert (it, t);
            // Range insert
            c.insert (it, it1, it2);
            // Erase
            c.erase (it);
            // Range erase
            c.erase (it1, it2);
            // Clear
            c.clear ();
            // Resize 
            c.resize (n);
        }
    };

    template<class C>
    struct SparseStorageContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        
        static void constraints () {
            ReversibleContainerConcept<container_type>::constraints ();
        }
    };

    template<class C>
    struct MutableSparseStorageContainerConcept {
        typedef C container_type;
        typedef typename C::size_type size_type;
        typedef typename C::value_type value_type;
        typedef typename C::iterator iterator_type;
        
        static void constraints () {
            MutableReversibleContainerConcept<container_type>::constraints ();
            container_type c = container_type ();
            value_type t = value_type ();
            iterator_type it = iterator_type (), it1 = iterator_type (), it2 = iterator_type ();
            // Insert 
            c.insert (it, t);
#ifdef BOOST_UBLAS_NON_STD
            // Range insert
            c.insert (it, it1, it2);
#endif
            // Erase
            c.erase (it);
            // Range erase
            c.erase (it1, it2);
            // Clear 
            c.clear ();
        }
    };

    template<class G>
    struct IndexSetConcept {
        typedef G generator_type;
        typedef typename G::size_type size_type;
        typedef typename G::value_type value_type;

        static void constraints () {
            DefaultConstructibleConcept<generator_type>::constraints ();    
            ReversibleContainerConcept<generator_type>::constraints ();
            generator_type g = generator_type ();
            size_type n (0);
            value_type t = value_type ();
            // Element access 
            t = g (n);
            ignore_unused_variable_warning (t);
        }
    };

    template<class S>
    struct ScalarExpressionConcept {
        typedef S scalar_type;
        typedef typename S::value_type value_type;
        
        static void constraints () {
            DefaultConstructibleConcept<scalar_type>::constraints ();
            scalar_type s = scalar_type ();
            value_type t = value_type ();
            // Conversion
            t = s;
            ignore_unused_variable_warning (t);
        }

⌨️ 快捷键说明

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