| Home | Libraries | People | FAQ | More

## Reference Section of Boost.Any

### Header <boost/any.hpp>

A class whose instances can hold instances of any type that satisfies ValueType requirements.

    namespace boost {
      class any;
      void swap(any &, any &);
      template<typename ValueType> ValueType * any_cast(any *);
      template<typename ValueType> const ValueType * any_cast(const any *);
      template<typename ValueType> ValueType any_cast(any &);
      template<typename ValueType> ValueType any_cast(const any &);
      template<typename ValueType> ValueType any_cast(any &&);
    }

### Header <boost/any/bad_any_cast.hpp>

    namespace boost {
      class bad_any_cast;
    }

### Header <boost/any/basic_any.hpp>

A class with customizable Small Object Optimization whose instances can hold instances of any type that satisfies ValueType requirements. Use boost::any instead if not sure.

    namespace boost {
      template<typename T> T * any_cast(unique_any *);
      namespace anys {
        template<std::size_t OptimizeForSize, std::size_t OptimizeForAlignment>
          class basic_any;
        template<std::size_t OptimizeForSize, std::size_t OptimizeForAlignment>
          void swap(basic_any< OptimizeForSize, OptimizeForAlignment > &,
                    basic_any< OptimizeForSize, OptimizeForAlignment > &);
        template<typename ValueType, std::size_t Size, std::size_t Alignment>
          ValueType * any_cast(basic_any< Size, Alignment > *);
        template<typename ValueType, std::size_t OptimizeForSize,
                 std::size_t OptimizeForAlignment>
          const ValueType *
          any_cast(const basic_any< OptimizeForSize, OptimizeForAlignment > *);
        template<typename ValueType, std::size_t OptimizeForSize,
                 std::size_t OptimizeForAlignment>
          ValueType any_cast(basic_any< OptimizeForSize, OptimizeForAlignment > &);
        template<typename ValueType, std::size_t OptimizeForSize,
                 std::size_t OptimizeForAlignment>
          ValueType any_cast(const basic_any< OptimizeForSize, OptimizeForAlignment > &);
        template<typename ValueType, std::size_t OptimizeForSize,
                 std::size_t OptimizeForAlignment>
          ValueType any_cast(basic_any< OptimizeForSize, OptimizeForAlignment > &&);
      }
    }

### Header <boost/any/fwd.hpp>

Forward declarations of Boost.Any library types.

### Header <boost/any/unique_any.hpp>

A class whose instances can hold instances of any type (including non-copyable and non-movable types).

    namespace boost {
      template<typename T> T * any_cast(unique_any *);
      namespace anys {
        template<typename T> struct in_place_type_t;

        class unique_any;

        in_place_type_t< T > in_place_type;
        void swap(unique_any &, unique_any &);
        template<typename T> T * any_cast(unique_any *);
        template<typename T> const T * any_cast(const unique_any *);
        template<typename T> T any_cast(unique_any &);
        template<typename T> T any_cast(const unique_any &);
        template<typename T> T any_cast(unique_any &&);
      }
    }