Mercurial > hg > vamp-build-and-test
view DEPENDENCIES/generic/include/boost/type_erasure/detail/storage.hpp @ 40:a7005ff33d3c
OS/X build fixes
author | Chris Cannam |
---|---|
date | Thu, 07 Aug 2014 08:17:36 +0100 |
parents | 2665513ce2d3 |
children | c530137014c0 |
line wrap: on
line source
// Boost.TypeErasure library // // Copyright 2011 Steven Watanabe // // Distributed under the Boost Software License Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // $Id: storage.hpp 83253 2013-03-02 21:48:27Z steven_watanabe $ #ifndef BOOST_TYPE_ERASURE_DETAIL_STORAGE_HPP_INCLUDED #define BOOST_TYPE_ERASURE_DETAIL_STORAGE_HPP_INCLUDED #include <boost/type_traits/remove_reference.hpp> namespace boost { namespace type_erasure { namespace detail { struct storage { storage() {} template<class T> storage(const T& arg) : data(new T(arg)) {} void* data; }; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template<class T> T extract(T arg) { return std::forward<T>(arg); } #else template<class T> T extract(T arg) { return arg; } #endif template<class T> T extract(storage& arg) { return *static_cast<typename ::boost::remove_reference<T>::type*>(arg.data); } template<class T> T extract(const storage& arg) { return *static_cast<const typename ::boost::remove_reference<T>::type*>(arg.data); } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template<class T> T extract(storage&& arg) { return std::move(*static_cast<typename ::boost::remove_reference<T>::type*>(arg.data)); } #endif } } } #endif