Skip to content

Commit

Permalink
Merge pull request #160 from TypeCombinator/master
Browse files Browse the repository at this point in the history
Solution to 356.md
  • Loading branch information
kris-jusiak authored Nov 25, 2024
2 parents 697f1db + 2a19b81 commit 3ead9cc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tips/356.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,22 @@ constexpr auto is_unique = sizeof(S<Ts...>) == 1;

> https://godbolt.org/z/rM5q93WEh

```cpp
template <typename T>
struct empty_wrap { };

template <typename T, typename = decltype([]() {})>
struct unique_empty_box {
[[no_unique_address]] empty_wrap<T> e;
};

template <typename... Ts>
struct empty_type_pack : public unique_empty_box<Ts>... { };

template <typename... Ts>
constexpr bool is_unique = sizeof(empty_type_pack<Ts...>) == 1;
```
> https://godbolt.org/z/1h44G3fKa
</p></details>

0 comments on commit 3ead9cc

Please sign in to comment.