Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class variable_value

boost::program_options::variable_value

Synopsis

class variable_value {
public:
  // construct/copy/destruct
  variable_value();
  variable_value(const boost::any &, bool);

  // public member functions
  template<typename T> const T & as() const;
  template<typename T> T & as() ;
  bool empty() const;
  bool defaulted() const;
  const boost::any & value() const;
  boost::any & value() ;
};

Description

Class holding value of option. Contains details about how the value is set and allows to conveniently obtain the value.

variable_value public construct/copy/destruct

  1. variable_value();
  2. variable_value(const boost::any & v, bool defaulted);

variable_value public member functions

  1. template<typename T> const T & as() const;

    If stored value if of type T, returns that value. Otherwise, throws boost::bad_any_cast exception.

  2. template<typename T> T & as() ;
  3. bool empty() const;
  4. bool defaulted() const;

    Returns true if the value was not explicitly given, but has default value.

  5. const boost::any & value() const;

    Returns the contained value.

  6. boost::any & value() ;

    Returns the contained value.


PrevUpHomeNext