array 修正

This commit is contained in:
bolero-MURAKAMI 2011-09-05 11:51:05 +09:00
parent d12cab546c
commit ef62b3f483
4 changed files with 14 additions and 14 deletions

View file

@ -51,22 +51,22 @@ namespace sprout {
} }
} }
iterator begin() SPROUT_NOEXCEPT { iterator begin() SPROUT_NOEXCEPT {
return elems; return &elems[0];
} }
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT {
return elems; return &elems[0];
} }
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT {
return elems; return &elems[0];
} }
iterator end() SPROUT_NOEXCEPT { iterator end() SPROUT_NOEXCEPT {
return elems + size(); return &elems[0] + size();
} }
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT {
return elems + size(); return &elems[0] + size();
} }
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT {
return elems + size(); return &elems[0] + size();
} }
reverse_iterator rbegin() SPROUT_NOEXCEPT { reverse_iterator rbegin() SPROUT_NOEXCEPT {
return reverse_iterator(begin()); return reverse_iterator(begin());
@ -113,13 +113,13 @@ namespace sprout {
return elems[size() - 1]; return elems[size() - 1];
} }
pointer data() SPROUT_NOEXCEPT { pointer data() SPROUT_NOEXCEPT {
return elems; return &elems[0];
} }
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT {
return elems; return &elems[0];
} }
pointer c_array() SPROUT_NOEXCEPT { pointer c_array() SPROUT_NOEXCEPT {
return elems; return &elems[0];
} }
void assign(const_reference value) { void assign(const_reference value) {
fill(value); fill(value);
@ -222,7 +222,7 @@ namespace sprout {
// //
template<typename T, typename... Tail> template<typename T, typename... Tail>
SPROUT_CONSTEXPR inline sprout::array<T, 1 + sizeof...(Tail)> make_array(T const& head, Tail const&... tail) { SPROUT_CONSTEXPR inline sprout::array<T, 1 + sizeof...(Tail)> make_array(T const& head, Tail const&... tail) {
return sprout::array<T, 1 + sizeof...(Tail)>{head, tail...}; return sprout::array<T, 1 + sizeof...(Tail)>{{head, tail...}};
} }
template<typename T> template<typename T>
SPROUT_CONSTEXPR inline sprout::array<T, 0> make_array() { SPROUT_CONSTEXPR inline sprout::array<T, 0> make_array() {
@ -236,7 +236,7 @@ namespace sprout {
sprout::index_tuple<Indexes...> sprout::index_tuple<Indexes...>
) )
{ {
return sprout::array<T, N>{arr[Indexes]...}; return sprout::array<T, N>{{arr[Indexes]...}};
} }
} // namespace detail } // namespace detail
// //

View file

@ -14,7 +14,7 @@ namespace sprout {
return range.begin(); return range.begin();
} }
template<typename T, std::size_t N> template<typename T, std::size_t N>
typename sprout::fixed_container_traits<T const[N]>::iterator begin(T (& arr)[N]) { typename sprout::fixed_container_traits<T[N]>::iterator begin(T (& arr)[N]) {
return arr; return arr;
} }
// //

View file

@ -119,7 +119,7 @@ namespace sprout {
public: public:
template<typename... Args> template<typename... Args>
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(Args const&... args) const { SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(Args const&... args) const {
return typename sprout::fixed_container_traits<Container>::clone_type{args...}; return typename sprout::fixed_container_traits<Container>::clone_type{{args...}};
} }
}; };

View file

@ -292,7 +292,7 @@ namespace sprout {
sprout::index_tuple<Indexes...> sprout::index_tuple<Indexes...>
) )
{ {
return sprout::basic_string<T, N - 1>{arr[Indexes]...}; return sprout::basic_string<T, N - 1>{{arr[Indexes]...}};
} }
} // namespace detail } // namespace detail
// //