爲什麼不如下編譯:理解的boost ::變種
void f(int8_t a)
{
}
void f(int16_t a)
{
}
typedef boost::variant<int8_t, int16_t> AttrValue;
int main()
{
AttrValue a;
a = int8_t(1);
f(a);
}
隨着編譯器錯誤:
error C2665: 'f' : none of the 2 overloads could convert all the argument types
could be 'void f(int8_t)'
or 'void f(int16_t)'
然而,這是確定:
std::cout << a; // f(a);
在哪裏std :: ostream &運營商< <(std :: ostream &,const AttrValue &)定義,爲什麼定義?
什麼是boost用於?它有什麼作用?線程? GPU編程? – 2012-08-09 12:34:25
@tuğrulbüyükışık - http://www.boost.org/ – 2012-08-09 12:35:55
@tuğrulbüyükışık:boost是迄今爲止最知名的標準之外的C++庫。 www.boost.org – Gorpik 2012-08-09 12:36:48