diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/reassign.sfinae | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/reassign.sfinae b/examples/reassign.sfinae new file mode 100644 index 0000000..9863cae --- /dev/null +++ b/examples/reassign.sfinae @@ -0,0 +1,16 @@ +// there is no assignment. to change x, undeclare it and declare it again +// if the new value depends on the old one, park it in a second variable first, +// because the old one is gone by the time you declare + +::declare<::name<'x'>, ::decltype(::difference<'F', 'A'>)>::commit; +::emit<::decltype(::value_of<::name<'x'>>)>::commit; + +::declare< + ::name<'n', 'e', 'x', 't'>, + ::decltype(::sum<::value_of<::name<'x'>>, ::difference<'B', 'A'>>) +>::commit; +::undeclare<::name<'x'>>::commit; +::declare<::name<'x'>, ::decltype(::value_of<::name<'n', 'e', 'x', 't'>>)>::commit; +::undeclare<::name<'n', 'e', 'x', 't'>>::commit; + +::emit<::decltype(::value_of<::name<'x'>>)>::commit; |
