blob: b9e1a35c6e67c2aa0bea80c512f6e1568f03e7b1 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// common_type.hpp ---------------------------------------------------------//
2
3// Copyright 2010 Vicente J. Botet Escriba
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
Jeff Thompson3d613fd2013-10-15 15:39:04 -07008#ifndef NDNBOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
9#define NDNBOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
Jeff Thompsona28eed82013-08-22 16:21:10 -070010
11#include <ndnboost/config.hpp>
12
13//----------------------------------------------------------------------------//
14
15#include <ndnboost/type_traits/add_rvalue_reference.hpp>
16//#include <ndnboost/type_traits/add_lvalue_reference.hpp>
17
18//----------------------------------------------------------------------------//
19// //
20// C++03 implementation of //
21// Written by Vicente J. Botet Escriba //
22//~ 20.3.4 Function template declval [declval]
23//~ 1 The library provides the function template declval to simplify the definition of expressions which occur as
24//~ unevaluated operands.
25//~ 2 Remarks: If this function is used, the program is ill-formed.
26//~ 3 Remarks: The template parameter T of declval may be an incomplete type.
27//~ [ Example:
28
29//~ template <class To, class From>
30//~ decltype(static_cast<To>(declval<From>())) convert(From&&);
31
32//~ declares a function template convert which only participats in overloading if the type From can be
33//~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). —end
34//~ example ]
35// //
36//----------------------------------------------------------------------------//
37
38namespace ndnboost {
39
Jeff Thompson3d613fd2013-10-15 15:39:04 -070040//#if !defined(NDNBOOST_NO_RVALUE_REFERENCES)
Jeff Thompsona28eed82013-08-22 16:21:10 -070041 template <typename T>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070042 typename add_rvalue_reference<T>::type declval() NDNBOOST_NOEXCEPT; // as unevaluated operand
Jeff Thompsona28eed82013-08-22 16:21:10 -070043//#else
44// template <typename T>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045// typename add_lvalue_reference<T>::type declval() NDNBOOST_NOEXCEPT; // as unevaluated operand
Jeff Thompsona28eed82013-08-22 16:21:10 -070046//#endif
47} // namespace ndnboost
48
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049#endif // NDNBOOST_TYPE_TRAITS_EXT_DECLVAL__HPP