thambs
Да, правильно. Это всё нужно по большому счёту для шаблонного программирования.
__________________
So she began again: 'Où est ma chatte?' which was the first sentence in her French lesson-book. The Mouse gave a sudden leap out of the water, and seemed to quiver all over with fright. 'Oh, I beg your pardon!' cried Alice hastily, afraid that she had hurt the poor animal's feelings. 'I quite forgot you didn't like cats.'
thambs
Насколько я знаю, if constexpr ведёт себя идентично if в обычных функциях.
Разница возникает в constexpr-функциях. Такие функции не скомпилируются с обычным if, потому что он гарантирует, что лишь одна из веток будет выполняться, а вот constexpr-if гарантирует, что лишь одна из веток будет компилироваться.
Ещё раз - это всё нужно в метапрограммировании, когда мы из-за отсутствия if constexpr в С++14 (интересно, многие ли уже на С++17 перешли?) городим этажерки с std::enable_if.
__________________
So she began again: 'Où est ma chatte?' which was the first sentence in her French lesson-book. The Mouse gave a sudden leap out of the water, and seemed to quiver all over with fright. 'Oh, I beg your pardon!' cried Alice hastily, afraid that she had hurt the poor animal's feelings. 'I quite forgot you didn't like cats.'
__________________
So she began again: 'Où est ma chatte?' which was the first sentence in her French lesson-book. The Mouse gave a sudden leap out of the water, and seemed to quiver all over with fright. 'Oh, I beg your pardon!' cried Alice hastily, afraid that she had hurt the poor animal's feelings. 'I quite forgot you didn't like cats.'