Тёмный

how i use bit flags in c++ 

colugo
Подписаться 5 тыс.
Просмотров 599
50% 1

Опубликовано:

 

29 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 7   
@chroma.z
@chroma.z 6 месяцев назад
I think when you do "typename Flag = ..." you're actually just setting the *default* type of Flag, so there's not any constraint there... so that's why it lets you use flags from a different struct. if you use "typename Mask::e" as the argument type it seems to work, and correctly fails if the types don't match.
@chroma.z
@chroma.z 6 месяцев назад
youtube seems to block godbolt links but try this: vs3PbE6Es
@colugo5172
@colugo5172 6 месяцев назад
Ah yes of course that makes sense. Not sure what i was thinking !
@TheBorinator420
@TheBorinator420 7 месяцев назад
I can't tell whether your neat enum-in-struct implementation is enabled as the result of terrible or genius design on the part of the C++ designers. In some ways I find your solution very compelling, but the lack of proper generic constraints requiring you to do weird stuff with just makes me want to return to the wilful ignorance I can enjoy from using children's languages like C#.
@colugo5172
@colugo5172 7 месяцев назад
In C++20 the problem of constraining types is much improved with the introduction of concepts to the language so i believe there is no need to ever use enable_if anymore if you are using c++20 or higher. I don't think there is anything to make working with bit flags any better though
Далее
Bitwise Operators and WHY we use them
8:41
Просмотров 86 тыс.
无意间发现了老公的小金库 #一键入戏
00:20
ХУДШИЕ ВЫБОРЫ в США
13:20
Просмотров 505 тыс.
working on the CLAP track effect rack
44:40
nobita.h #08 : Custom Error Handling
45:06
new carnival stuff in v0.41.0 alpha
7:36
Просмотров 1,1 тыс.
blockhead/CLAP integration ideas
16:28
Просмотров 1 тыс.
Next.js 15 Breakdown (Everything You Need To Know)
18:10
what to use instead of a singleton in c++
1:34