Maybe I missed something, but what is the way of constructing an if-then-else expression using the z3 C++ API ?
I could use the C API for that, but I'm wondering why there is no such function in the C++ API.
regards, Julien
Maybe I missed something, but what is the way of constructing an if-then-else expression using the z3 C++ API ?
I could use the C API for that, but I'm wondering why there is no such function in the C++ API.
regards, Julien
We can mix the C and C++ APIs. The file
examples/c++/example.cpp
contains an example using the C API to create the if-then-else expression. The functionto_expr
is essentially wrapping aZ3_ast
with the C++ "smart pointer"expr
that automatically manages the reference counters for us.I just added the
ite
function to the C++ API. It will be available in the next release (v4.3.2). If you want you can add to thez3++.h
file in your system. A good place to include is after the functionimplies
:Using this function, we can write: