views:

157

answers:

2

So I know that C++ is strongly typed and was just wondering if there was any library (or any thing for that fact of the matter) that would allow you to make a variable that has no initial specific type like var in Python.

+2  A: 

Two main things come to mind:

  1. BOOST_AUTO
  2. C++0x type inference
sharth
+1 for Boost, although I still find it ugly..
Xavier Ho
Type inference is strongly typed and thus not all the same as a var type.
FredOverflow
Yep `auto` is more like `var` in C#, i think.
Johannes Schaub - litb
+9  A: 

Take a look at boost::any and boost::variant.

Nikolai N Fetissov