Skip to content

Commit c6533e5

Browse files
authored
Merge pull request EzoeRyou#25 from tositeru/fix-type-vector-implementation
typo1個所とempty関数の戻り値がboolではなくてsize_typeになっていた
2 parents 4f2c1cd + 61409a1 commit c6533e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

033-vector-implementation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public :
321321
322322
// イテレーターアクセス
323323
iterator begin() noexcept ;
324-
iteratoe end() noexcept ;
324+
iterator end() noexcept ;
325325
} ;
326326
~~~
327327

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

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

934934
~~~c++
935-
size_type empty() const noexcept
935+
bool empty() const noexcept
936936
{
937937
return begin() == end() ;
938938
}

0 commit comments

Comments
 (0)