hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/examples/chars.sfinae
blob: b38118ba8d1cce3f426ac796da396325b8b5ac8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;