1

IDE - Clion, C++11, Boost Version 1.57.0

Why doesn't work this code?

#include "boost/any.hpp"
...
boost::any var = 1550;   // Works
var = "String";  // Error

But works fine this one:

#include "boost/any.hpp"
...
boost::any var = 1550;   // Works
var = string("String");  // Works

Can you explain me reason of this error?

Person.Junkie
  • 1,816
  • 4
  • 21
  • 31

1 Answers1

2

boost::any — A class whose instances can hold instances of any type that satisfies ValueType requirements. see this: http://www.boost.org/doc/libs/1_55_0/doc/html/boost/any.html

Melina Golez
  • 164
  • 2
  • 10
  • 3
    There is no relevant information in this answer. There is a link, but it's not even at all clear what part of the linked page you're thinking about. –  Dec 14 '14 at 18:22