| 1425 | * given in the constructor, which is of another type TargetType |
| 1426 | */ |
| 1427 | template <typename SrcType, typename TargetType> struct constexpr_write_ptr { |
| 1428 | constexpr explicit constexpr_write_ptr(TargetType *raw) : p(raw) {} |
| 1429 | |
| 1430 | constexpr constexpr_write_ptr_proxy<SrcType, TargetType> operator*() const { |
| 1431 | return constexpr_write_ptr_proxy<SrcType, TargetType>{p}; |
| 1432 | } |
| 1433 | |
| 1434 | constexpr constexpr_write_ptr_proxy<SrcType, TargetType> |
| 1435 | operator[](std::ptrdiff_t n) const { |
| 1436 | return constexpr_write_ptr_proxy<SrcType, TargetType>{p + n}; |
| 1437 | } |
| 1438 | |
| 1439 | constexpr constexpr_write_ptr &operator++() { |
| 1440 | ++p; |
| 1441 | return *this; |
| 1442 | } |
| 1443 | |
| 1444 | constexpr constexpr_write_ptr operator++(int) { |
| 1445 | constexpr_write_ptr old = *this; |
| 1446 | ++p; |
| 1447 | return old; |
| 1448 | } |
| 1449 | |
| 1450 | constexpr std::ptrdiff_t operator-(const constexpr_write_ptr &other) const { |
| 1451 | return p - other.p; |
| 1452 | } |
| 1453 | |
| 1454 | TargetType *p; |
| 1455 | }; |
| 1456 | |
| 1457 | template <typename SrcType, typename TargetType> |
| 1458 | constexpr auto constexpr_cast_writeptr(TargetType *raw) { |
nothing calls this directly
no outgoing calls
no test coverage detected