Skip to content

Commit

Permalink
bitset: P2417R2 constexpr化(#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohhoy committed Jan 16, 2023
1 parent 58fba8b commit 53c9bf6
Show file tree
Hide file tree
Showing 28 changed files with 147 additions and 80 deletions.
5 changes: 3 additions & 2 deletions reference/bitset/bitset/all.md
Expand Up @@ -6,7 +6,8 @@
* cpp11[meta cpp]

```cpp
bool all() const noexcept;
bool all() const noexcept; // (1) C++11
constexpr bool all() const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -63,4 +64,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
8 changes: 5 additions & 3 deletions reference/bitset/bitset/any.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
bool any() const; // C++03
bool any() const noexcept; // C++11
bool any() const; // (1) C++03
bool any() const noexcept; // (1) C++11
constexpr bool any() const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -49,5 +50,6 @@ int main()
```
```

## 参照

## 参照
- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
9 changes: 7 additions & 2 deletions reference/bitset/bitset/count.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
size_t count() const; // C++03
size_t count() const noexcept; // C++11
size_t count() const; // (1) C++03
size_t count() const noexcept; // (1) C++11
constexpr size_t count() const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -71,3 +72,7 @@ int main()

## 関連項目
- [`std::popcount()`](/reference/bit/popcount.md)


## 参照
- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
10 changes: 6 additions & 4 deletions reference/bitset/bitset/flip.md
Expand Up @@ -5,10 +5,12 @@
* function[meta id-type]

```cpp
bitset<N>& flip(); // (1) C++03
bitset<N>& flip() noexcept; // (1) C++11
bitset<N>& flip(); // (1) C++03
bitset<N>& flip() noexcept; // (1) C++11
constexpr bitset<N>& flip() noexcept; // (1) C++23

bitset<N>& flip(size_t pos); // (2)
bitset<N>& flip(size_t pos); // (2) C++03
constexpr bitset<N>& flip(size_t pos); // (2) C++23
```
## 概要
Expand Down Expand Up @@ -64,4 +66,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
7 changes: 5 additions & 2 deletions reference/bitset/bitset/none.md
Expand Up @@ -5,7 +5,9 @@
* function[meta id-type]

```cpp
bool none() const noexcept;
bool none() const; // (1) C++03
bool none() const noexcept; // (1) C++11
constexpr bool none() const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -48,5 +50,6 @@ int main()
```
```

## 参照

## 参照
- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
9 changes: 6 additions & 3 deletions reference/bitset/bitset/op_and.md
Expand Up @@ -6,10 +6,13 @@
```cpp
namespace std {
template <size_t N>
bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs); // C++03
bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs); // (1) C++03

template <size_t N>
bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // C++11
bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // (1) C++11

template <size_t N>
constexpr bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // (1) C++23
}
```
Expand Down Expand Up @@ -54,4 +57,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
7 changes: 4 additions & 3 deletions reference/bitset/bitset/op_and_assign.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
bitset<N>& operator&=(const bitset<N>& rhs); // C++03
bitset<N>& operator&=(const bitset<N>& rhs) noexcept; // C++11
bitset<N>& operator&=(const bitset<N>& rhs); // (1) C++03
bitset<N>& operator&=(const bitset<N>& rhs) noexcept; // (1) C++11
constexpr bitset<N>& operator&=(const bitset<N>& rhs) noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -48,4 +49,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
5 changes: 3 additions & 2 deletions reference/bitset/bitset/op_at.md
Expand Up @@ -9,7 +9,8 @@ bool operator[](size_t pos) const; // (1) C++03
constexpr bool operator[](size_t pos); // (1) C++11
constexpr bool operator[](size_t pos) const; // (1) C++14

reference operator[](size_t pos); // (2)
reference operator[](size_t pos); // (2) C++03
constexpr reference operator[](size_t pos); // (2) C++23
```
* reference[link reference.md]

Expand Down Expand Up @@ -58,4 +59,4 @@ false

## 参照
- [N3669 Fixing constexpr member functions without const](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3669.pdf)

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
16 changes: 15 additions & 1 deletion reference/bitset/bitset/op_constructor.md
Expand Up @@ -26,11 +26,25 @@ explicit bitset(
basic_string<CharT, Traits, Allocator>::npos,
CharT zero = CharT('0'), CharT one = CharT('1')); // (3) C++11

template <class CharT, class Traits, class Allocator>
constexpr explicit bitset(
const basic_string<CharT, Traits, Allocator>& str,
typename basic_string<CharT, Traits, Allocator>::size_type pos = 0,
typename basic_string<CharT, Traits, Allocator>::size_type n =
basic_string<CharT, Traits, Allocator>::npos,
CharT zero = CharT('0'), CharT one = CharT('1')); // (3) C++23

template <class CharT>
explicit bitset(
const CharT* str,
typename basic_string<CharT>::size_type n = basic_string<CharT>::npos,
CharT zero = CharT('0'), CharT one = CharT('1')); // (4) C++11

template <class CharT>
constexpr explicit bitset(
const CharT* str,
typename basic_string<CharT>::size_type n = basic_string<CharT>::npos,
CharT zero = CharT('0'), CharT one = CharT('1')); // (4) C++23
```
* basic_string[link /reference/string/basic_string.md]
Expand Down Expand Up @@ -122,4 +136,4 @@ int main()
## 参照
- [LWG Issue 778. `std::bitset` does not have any constructor taking a string literal](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#778)
- (4)のコンストラクタが追加された経緯となるレポート

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
7 changes: 4 additions & 3 deletions reference/bitset/bitset/op_equal.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
bool operator==(const bitset<N>& rhs) const; // C++03
bool operator==(const bitset<N>& rhs) const noexcept; // C++11
bool operator==(const bitset<N>& rhs) const; // (1) C++03
bool operator==(const bitset<N>& rhs) const noexcept; // (1) C++11
constexpr bool operator==(const bitset<N>& rhs) const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -47,4 +48,4 @@ equal


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
6 changes: 4 additions & 2 deletions reference/bitset/bitset/op_flip.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
bitset<N> operator~() const; // C++03
bitset<N> operator~() const noexcept; // C++11
bitset<N> operator~() const; // (1) C++03
bitset<N> operator~() const noexcept; // (1) C++11
constexpr bitset<N> operator~() const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -49,4 +50,5 @@ int main()


## 参照
- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)

6 changes: 4 additions & 2 deletions reference/bitset/bitset/op_left_shift.md
Expand Up @@ -5,7 +5,9 @@
* function[meta id-type]

```cpp
bitset<N> operator<<(size_t pos) const noexcept;
bitset<N> operator<<(size_t pos) const; // (1) C++03
bitset<N> operator<<(size_t pos) const noexcept; // (1) C++11
constexpr bitset<N> operator<<(size_t pos) const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -48,4 +50,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
6 changes: 4 additions & 2 deletions reference/bitset/bitset/op_left_shift_assign.md
Expand Up @@ -5,7 +5,9 @@
* function[meta id-type]

```cpp
bitset<N>& operator<<=(size_t pos) noexcept;
bitset<N>& operator<<=(size_t pos); // (1) C++03
bitset<N>& operator<<=(size_t pos) noexcept; // (1) C++11
constexpr bitset<N>& operator<<=(size_t pos) noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -46,4 +48,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
4 changes: 3 additions & 1 deletion reference/bitset/bitset/op_not_equal.md
Expand Up @@ -7,7 +7,8 @@
```cpp
// operator==により、以下のオーバーロードが使用可能になる (C++20)
bool operator!=(const bitset<N>& rhs) const; // (1) C++03
bool operator!=(const bitset<N>& rhs) const noexcept; // (2) C++11
bool operator!=(const bitset<N>& rhs) const noexcept; // (1) C++11
constexpr bool operator!=(const bitset<N>& rhs) const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -54,3 +55,4 @@ not equal
## 参照
- [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html)
- C++20での三方比較演算子の追加と、関連する演算子の自動導出
- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
9 changes: 6 additions & 3 deletions reference/bitset/bitset/op_or.md
Expand Up @@ -6,10 +6,13 @@
```cpp
namespace std {
template <size_t N>
bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs); // C++03
bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs); // (1) C++03

template <size_t N>
bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // C++11
bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // (1) C++11

template <size_t N>
constexpr bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // (1) C++23
}
```
Expand Down Expand Up @@ -54,4 +57,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
7 changes: 4 additions & 3 deletions reference/bitset/bitset/op_or_assign.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
bitset<N>& operator|=(const bitset<N>& rhs); // C++03
bitset<N>& operator|=(const bitset<N>& rhs) noexcept; // C++11
bitset<N>& operator|=(const bitset<N>& rhs); // (1) C++03
bitset<N>& operator|=(const bitset<N>& rhs) noexcept; // (1) C++11
constexpr bitset<N>& operator|=(const bitset<N>& rhs) noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -48,4 +49,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
6 changes: 4 additions & 2 deletions reference/bitset/bitset/op_right_shift.md
Expand Up @@ -5,7 +5,9 @@
* function[meta id-type]

```cpp
bitset<N> operator>>(size_t pos) const noexcept;
bitset<N> operator>>(size_t pos) const; // (1) C++03
bitset<N> operator>>(size_t pos) const noexcept; // (1) C++11
constexpr bitset<N> operator>>(size_t pos) const noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -48,4 +50,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
6 changes: 4 additions & 2 deletions reference/bitset/bitset/op_right_shift_assign.md
Expand Up @@ -5,7 +5,9 @@
* function[meta id-type]

```cpp
bitset<N>& operator>>=(size_t pos) noexcept;
bitset<N>& operator>>=(size_t pos); // (1) C++03
bitset<N>& operator>>=(size_t pos) noexcept; // (1) C++11
constexpr bitset<N>& operator>>=(size_t pos) noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -46,4 +48,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
9 changes: 6 additions & 3 deletions reference/bitset/bitset/op_xor.md
Expand Up @@ -6,10 +6,13 @@
```cpp
namespace std {
template <size_t N>
bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs); // C++03
bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs); // (1) C++03

template <size_t N>
bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // C++11
bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // (1) C++11

template <size_t N>
constexpr bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs) noexcept; // (1) C++23
}
```
Expand Down Expand Up @@ -54,4 +57,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)
7 changes: 4 additions & 3 deletions reference/bitset/bitset/op_xor_assign.md
Expand Up @@ -5,8 +5,9 @@
* function[meta id-type]

```cpp
bitset<N>& operator^=(const bitset<N>& rhs); // C++03
bitset<N>& operator^=(const bitset<N>& rhs) noexcept; // C++11
bitset<N>& operator^=(const bitset<N>& rhs); // (1) C++03
bitset<N>& operator^=(const bitset<N>& rhs) noexcept; // (1) C++11
constexpr bitset<N>& operator^=(const bitset<N>& rhs) noexcept; // (1) C++23
```

## 概要
Expand Down Expand Up @@ -48,4 +49,4 @@ int main()


## 参照

- [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf)

0 comments on commit 53c9bf6

Please sign in to comment.