diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/chars.sfinae | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/chars.sfinae b/examples/chars.sfinae new file mode 100644 index 0000000..b38118b --- /dev/null +++ b/examples/chars.sfinae @@ -0,0 +1,16 @@ +// ::integral_constant<::char, V> is a type that says one character +// there are no character values, so it says its own distance from '\0' + +::emit<::integral_constant<::char, ::difference<'h', '\0'>>>::commit; +::emit<::integral_constant<::char, ::difference<'i', '\0'>>>::commit; + +// ::char on its own is a type like any other, and says its name +::emit<::remove_cv_t<::char>>::commit; + +// two character types are the same type when they say the same thing +::static_assert< + ::is_same< + ::integral_constant<::char, ::difference<'a', '\0'>>, + ::integral_constant<::char, ::sum<::difference<'a', 'b'>, ::difference<'b', '\0'>>> + >::value +>::commit; |
