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

📄 static_array.hpp

📁 新版本TR1的stl
💻 HPP
📖 第 1 页 / 共 5 页
字号:
    value_type const        *data() const;

// Implementation
protected:
    pointer     data_();
    index_type  calc_index_(index_type i0) const;
    void        range_check_(index_type i0) const stlsoft_throw_1(stlsoft_ns_qual_std(out_of_range) );

// Members
private:
    M   m_data;

// Not to be implemented
private:
    class_type const& operator =(class_type const& rhs);
};

// class static_array_2d
/** \brief 2 dimensional static array
 *
 * \ingroup group__library__containers
 *
 * \param T The value type
 * \param N0 The first dimension extent
 * \param N1 The second dimension extent
 * \param P The construction policy type
 */
template<   ss_typename_param_k T
        ,   ss_size_t N0
        ,   ss_size_t N1
#ifdef STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
        ,   ss_typename_param_k P   =   do_construction<T>
        ,   ss_typename_param_k M   =   T[N0 * N1]
#else /* ? STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT */
        ,   ss_typename_param_k P
        ,   ss_typename_param_k M
#endif /* STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT */
        >
class static_array_2d
    : public null_allocator<T>
    , public stl_collection_tag
{
public:
    typedef static_array_2d<T, N0, N1, P, M>                class_type;
    typedef static_array_1d<T, N1, P, T*>                   dimension_type;
    typedef null_allocator<T>                               allocator_type;
    typedef P                                               policy_type;

    typedef T                                               value_type;
    typedef value_type                                      &reference;
    typedef value_type const                                &const_reference;
    typedef value_type                                      *pointer;
    typedef value_type const                                *const_pointer;
    typedef ss_size_t                                       size_type;
    typedef ss_size_t                                       index_type;
    typedef ss_ptrdiff_t                                    difference_type;

    typedef
#if !defined(STLSOFT_COMPILER_IS_BORLAND)
           ss_typename_type_k
#endif /* compiler */
                       pointer_iterator <   value_type
                                        ,   pointer
                                        ,   reference
                                        >::type             iterator;
    typedef
#if !defined(STLSOFT_COMPILER_IS_BORLAND)
         ss_typename_type_k
#endif /* compiler */
                       pointer_iterator <   value_type const
                                        ,   const_pointer
                                        ,   const_reference
                                        >::type             const_iterator;

#ifdef STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT
    typedef reverse_iterator_base       <   iterator
                                        ,   value_type
                                        ,   reference
                                        ,   pointer
                                        ,   difference_type
                                        >                   reverse_iterator;

    typedef const_reverse_iterator_base <   const_iterator
                                        ,   value_type const
                                        ,   const_reference
                                        ,   const_pointer
                                        ,   difference_type
                                        >                   const_reverse_iterator;
#endif /* STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT */

// Construction
//protected:
//    static_array_2d(T data[N0][N1]);
    static_array_2d(T *data);
public:
    static_array_2d();
    static_array_2d(value_type const& t);
    static_array_2d(class_type const& rhs);
    ~static_array_2d() stlsoft_throw_0();

// Operations
public:
    reference               at(index_type i0, index_type i1);
    const_reference         at(index_type i0, index_type i1) const;

    reference               at_unchecked(index_type i0, index_type i1);
    const_reference         at_unchecked(index_type i0, index_type i1) const;

    dimension_type          at(index_type i0);
    const dimension_type    at(index_type i0) const;

    dimension_type          at_unchecked(index_type i0);
    const dimension_type    at_unchecked(index_type i0) const;

    dimension_type          operator [](index_type i0);
    const dimension_type    operator [](index_type i0) const;

    reference               front();
    reference               back();
    const_reference         front() const;
    const_reference         back() const;

// State
public:
    static index_type       dimension0();
    static index_type       dimension1();
    static index_type       size();
    static ss_bool_t        empty();
    static size_type        max_size();

// Iteration
public:
    iterator                begin();
    iterator                end();
    const_iterator          begin() const;
    const_iterator          end() const;

#ifdef STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT
    reverse_iterator        rbegin();
    reverse_iterator        rend();
    const_reverse_iterator  rbegin() const;
    const_reverse_iterator  rend() const;
#endif /* STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT */

// Access
public:
    value_type const        *data() const;

// Implementation
protected:
    pointer     data_();
    index_type  calc_index_(index_type i0, index_type i1) const;
    void        range_check_(index_type i0, index_type i1) const stlsoft_throw_1(stlsoft_ns_qual_std(out_of_range) );
    void        range_check_(index_type i0) const stlsoft_throw_1(stlsoft_ns_qual_std(out_of_range) );

// Members
private:
    M   m_data;

// Not to be implemented
private:
    class_type const& operator =(class_type const& rhs);
};

// class static_array_3d
/** \brief 3 dimensional static array
 *
 * \ingroup group__library__containers
 *
 * \param T The value type
 * \param N0 The first dimension extent
 * \param N1 The second dimension extent
 * \param N2 The third dimension extent
 * \param P The construction policy type
 */
template<   ss_typename_param_k T
        ,   ss_size_t N0
        ,   ss_size_t N1
        ,   ss_size_t N2
#ifdef STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
        ,   ss_typename_param_k P   =   do_construction<T>
        ,   ss_typename_param_k M   =   T[N0 * N1 * N2]
#else /* ? STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT */
        ,   ss_typename_param_k P
        ,   ss_typename_param_k M
#endif /* STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT */
        >
class static_array_3d
    : public null_allocator<T>
    , public stl_collection_tag
{
public:
    typedef static_array_3d<T, N0, N1, N2, P, M>            class_type;
    typedef static_array_2d<T, N1, N2, P, T*>               dimension_type;
    typedef null_allocator<T>                               allocator_type;
    typedef P                                               policy_type;

    typedef T                                               value_type;
    typedef value_type                                      &reference;
    typedef value_type const                                &const_reference;
    typedef value_type                                      *pointer;
    typedef value_type const                                *const_pointer;
    typedef ss_size_t                                       size_type;
    typedef ss_size_t                                       index_type;
    typedef ss_ptrdiff_t                                    difference_type;

    typedef
#if !defined(STLSOFT_COMPILER_IS_BORLAND)
           ss_typename_type_k
#endif /* compiler */
                       pointer_iterator <   value_type
                                        ,   pointer
                                        ,   reference
                                        >::type             iterator;
    typedef
#if !defined(STLSOFT_COMPILER_IS_BORLAND)
         ss_typename_type_k
#endif /* compiler */
                       pointer_iterator <   value_type const
                                        ,   const_pointer
                                        ,   const_reference
                                        >::type             const_iterator;

#ifdef STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT
    typedef reverse_iterator_base       <   iterator
                                        ,   value_type
                                        ,   reference
                                        ,   pointer
                                        ,   difference_type
                                        >                   reverse_iterator;

    typedef const_reverse_iterator_base <   const_iterator
                                        ,   value_type const
                                        ,   const_reference
                                        ,   const_pointer
                                        ,   difference_type
                                        >                   const_reverse_iterator;
#endif /* STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT */

// Construction
//protected:
//    static_array_3d(T data[N0][N1][N2]);
    static_array_3d(T *data);
public:
    static_array_3d();
    static_array_3d(value_type const& t);
    static_array_3d(class_type const& rhs);
    ~static_array_3d() stlsoft_throw_0();

// Operations
public:
    reference               at(index_type i0, index_type i1, index_type i2);
    const_reference         at(index_type i0, index_type i1, index_type i2) const;

    reference               at_unchecked(index_type i0, index_type i1, index_type i2);
    const_reference         at_unchecked(index_type i0, index_type i1, index_type i2) const;

    dimension_type          at(index_type i0);
    const dimension_type    at(index_type i0) const;

    dimension_type          at_unchecked(index_type i0);
    const dimension_type    at_unchecked(index_type i0) const;

    dimension_type          operator [](index_type i0);
    const dimension_type    operator [](index_type i0) const;

    reference               front();
    reference               back();
    const_reference         front() const;
    const_reference         back() const;

// State
public:
    static index_type       dimension0();
    static index_type       dimension1();
    static index_type       dimension2();
    static index_type       size();
    static ss_bool_t        empty();
    static size_type        max_size();

// Iteration
public:
    iterator                begin();
    iterator                end();
    const_iterator          begin() const;
    const_iterator          end() const;

#ifdef STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT
    reverse_iterator        rbegin();
    reverse_iterator        rend();
    const_reverse_iterator  rbegin() const;
    const_reverse_iterator  rend() const;
#endif /* STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT */

// Access
public:
    value_type const        *data() const;

// Implementation
protected:
    pointer     data_();
    index_type  calc_index_(index_type i0, index_type i1, index_type i2) const;
    void        range_check_(index_type i0, index_type i1, index_type i2) const stlsoft_throw_1(stlsoft_ns_qual_std(out_of_range) );
    void        range_check_(index_type i0) const stlsoft_throw_1(stlsoft_ns_qual_std(out_of_range) );

⌨️ 快捷键说明

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