SANJU V. S SANJU V. S - 6 months ago 52
C++ Question

Function return different types C++

Which is the best method to use when we need to return different types in a C++ function. Can anybody suggest the best among template, boost variant, union?


In your situation i prefer boost::variant. You can go through the official documentation. Or you can see example illustrated in this blog.