본문 바로가기

프로그램언어/boost

[ Boost ] Boost.Array Description

Boost.array는 iterator을 제공하고 있습니다. 

1. array Iterator Support

iterator begin();
const_iterator begin() const; 

Returns : iterator for the first element
Throws : will not throw

iterator end();
const_iterator end() const; 

Returns : iterator for position after the last element
Throws : will not throw





2. array reverse iterator support

reverse_iterator rbegin();

const_reverse_iterator rbegin() const;

Returns: reverse iterator for the first element of reverse iteration

reverse_iterator rend();

const_reverse_iterator rend() const;

Returns: reverse iterator for position after the last element in reverse iteration




3. array capacity

size_type size();

Returns: N

bool empty();

Returns: N==0
Throws: will not throw

size_type max_size();

 Returns: N
Throws: will not throw




4. array element access

reference operator[](size_type i);

const_reference operator[](size_type i) const;

Requires: i < N
Returns: element with index i
Throws: will not throw.

reference at(size_type i);

const_reference at(size_type i) const;

 Returns: element with index i
Throws: std::range_error if i >= N

reference front();

const_reference front() const;

Requires: N > 0
Returns: the first element
Throws: will not throw

reference back();

const_reference back() const;

Requires: N > 0
Returns: the last element
Throws: will not throw

const T* data() const;

Returns: elems
Throws: will not throw

T* c_array();

Returns: elems
Throws: will not throw




 5. array modifiers

void swap(array<T, N>& other);

Effects: std::swap_ranges(begin(), end(), other.begin())
Complexity: linear in N

void assign(const T& value);

Effects: std::fill_n(begin(), N, value)




6. array specialized algorithms

template<typename T, std::size_t N> void swap(array<T, N>& x, array<T, N>& y);

Effects: x.swap(y)
Throws: will not throw.




7. array comparisons

template<typename T, std::size_t N>

   bool operator==(const array<T, N>& x, const array<T, N>& y);

Returns: std::equal(x.begin(), x.end(), y.begin())

template<typename T, std::size_t N>

  bool operator!=(const array<T, N>& x, const array<T, N>& y);

Returns: !(x == y)

template<typename T, std::size_t N>

  bool operator<(const array<T, N>& x, const array<T, N>& y);

Returns: std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end())

template<typename T, std::size_t N>

  bool operator>(const array<T, N>& x, const array<T, N>& y);

Returns: y < x

template<typename T, std::size_t N>

  bool operator<=(const array<T, N>& x, const array<T, N>& y);

Returns: !(y < x)

template<typename T, std::size_t N>

  bool operator>=(const array<T, N>& x, const array<T, N>& y);

Returns: !(x < y)
 
 







 

'프로그램언어 > boost' 카테고리의 다른 글

[ Boost ] Boost.thread #1  (2) 2011.05.03
[ Boost ] Boost.array 관련 예제 만들어보기  (0) 2011.05.03
[ Boost ] Ref. array.hpp  (4) 2011.05.02
[ Boost ] Boost.Array 정리  (0) 2011.05.02
[ Boost ] boost.foreach 간단한 예제-2  (0) 2011.04.29