#constrains — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #constrains, aggregated by home.social.
-
CW: Оголошення обмежень після класу/структури в C++
У
C++20зʼявились концепти й обмеження для функцій, класів/структур та інших шаблонів. Для функцій та методів вимоги можна вказувати після оголошення шаблону або після функції.template<typename T> requires ... T f() {} template<typename T> T f() requires ... {}Якщо не шаблонний метод у шаблоні класу потребує додаткових вимог їх можна вказати після оголошення методу.
template<typename T> class S { T f() requires integer<T> {} };У такому випадку клас може згенеруватись з будь-яким типом, але це метод буде присутній тільки якщо шаблонний тип відповідає вимогам.
Але іноді може знадобитись використати поточний клас у вимогах. Наприклад при
CRTP.template<typename D> class Base requires std::derived_from<D, Base> {...};На жаль зараз такого немає.
#cpp #cxx #cpp20 #concepts #constrains #requires #class #template #struct #CRTP #proposal #програмування #шаблони #вимоги #обмеження #пропозиція
-
Dear Friends of FReedom,
As we may know, France and freedom have many #possibilities that the #enchanted, #entrapped and drones are trying to work.
For Example:
- Food grows with trees 🌱
- Nobody impoverishes #knowledge 📚
- She-shee sushhh 🤫
In other words, look, listen, learn to be a LLL. If we know, #share. What we the people R is #indefatigable.
How do I know?
1. By Knowing my sources and sauces. Food Done. 😌
2. Bye knowing by #tolled, #tithed and told. 🫡
3. Buy less is a #given. Make more use. 😶
So our #expectations and #capacities #servers #reminders. Language #transmits, knot #constrains. 🫶