8#ifndef INCLUDED_BSLS_UTIL
9#define INCLUDED_BSLS_UTIL
158#include <bsls_compilerfeatures.h>
179#ifdef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
181struct Util_RemoveReference {
186struct Util_RemoveReference<TYPE&> {
191struct Util_RemoveReference<TYPE&&> {
196struct Util_AssertNotLvalue {
201struct Util_AssertNotLvalue<TYPE&> {
203 "Cannot forward an rvalue as an lvalue.");
226 template <
class TYPE>
234 template <
class RESULT>
237 template <
class RESULT,
class ARG>
240 template <
class RESULT,
class ARG1,
class ARG2>
243 RESULT (&fn)(ARG1, ARG2));
245#ifdef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
246 template <
class TYPE>
249 TYPE&& forward(
typename Util_RemoveReference<TYPE>::type& t)
260 template <
class TYPE>
263 TYPE&& forward(
typename Util_RemoveReference<TYPE>::type&& t)
282#ifdef BSLS_PLATFORM_CMP_MSVC
283# define BSLS_UTIL_ADDRESSOF(OBJ) ::BloombergLP::bsls::Util::addressOf(OBJ)
285# if !defined(BDE_USE_ADDRESSOF)
286# define BDE_USE_ADDRESSOF
289# define BSLS_UTIL_ADDRESSOF(OBJ) (&(OBJ))
307 return static_cast<TYPE *
>(
309 const_cast<char *
>(&
reinterpret_cast<const volatile char&
>(obj))));
312template <
class RESULT>
320template <
class RESULT,
class ARG>
328template <
class RESULT,
class ARG1,
class ARG2>
336#ifdef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
339TYPE&& Util::forward(
typename Util_RemoveReference<TYPE>::type& t)
342 return static_cast<TYPE&&
>(t);
347TYPE&& Util::forward(
typename Util_RemoveReference<TYPE>::type&& t)
350 static_assert(
sizeof(
typename Util_AssertNotLvalue<TYPE>::type) > 0,
351 "Just to trigger instantiation of the checker template.");
352 return static_cast<TYPE&&
>(t);
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:588
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
Definition bdlt_iso8601util.h:691
Definition bsls_util.h:174
TYPE type
Definition bsls_util.h:176
Definition bsls_util.h:215
static TYPE * addressOf(TYPE &obj)
Definition bsls_util.h:305