Skip to content

Commit

Permalink
Merge pull request EzoeRyou#25 from tositeru/fix-type-vector-implemen…
Browse files Browse the repository at this point in the history
…tation

typo1個所とempty関数の戻り値がboolではなくてsize_typeになっていた
  • Loading branch information
EzoeRyou authored Dec 10, 2018
2 parents 4f2c1cd + 61409a1 commit c6533e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 033-vector-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public :
// イテレーターアクセス
iterator begin() noexcept ;
iteratoe end() noexcept ;
iterator end() noexcept ;
} ;
~~~

Expand Down Expand Up @@ -923,7 +923,7 @@ size_type size() const noexcept
`empty`は空であればtrue、そうでなければfalseを返す。「空」というのは要素数がゼロという意味だ。

~~~c++
size_type empty() const noexcept
bool empty() const noexcept
{
return size() == 0 ;
}
Expand All @@ -932,7 +932,7 @@ size_type empty() const noexcept
しかし`size() == 0`というのは、`begin() == end()`ということだ。なぜならば要素数が0であれば、イテレーターのペアはどちらも終端のイテレーターを差しているからだ。本物の`std::vector`では以下のように実装されている。

~~~c++
size_type empty() const noexcept
bool empty() const noexcept
{
return begin() == end() ;
}
Expand Down

0 comments on commit c6533e5

Please sign in to comment.