Skip to main content

General Utilities

  • Chapter
  • First Online:
  • 2210 Accesses

Abstract

This section explains move(), move_if_noexcept(), forward(), swap(), and exchange(). In passing, we also introduce the concepts of move semantics and perfect forwarding.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    unique() is deprecated in C++17 and removed in C++20.

  2. 2.

     The old ptr_fun(), mem_fun(), mem_fun_ref(), bind1st(), bind2nd(), their return types, as well as the base classes unary_function and binary_function that were defined in <functional> have been removed from the C++17 version of the standard.

  3. 3.

    type_info is a structure containing information about a given type. It is explained under “Type Utilities” later in this chapter. For now it suffices to know that you can call name() on a type_info instance to get the full name of a given type. It requires the <typeinfo> header.

  4. 4.

      As we explain later, the actual output of std::type_info::name() depends on your compiler. With Microsoft Visual Studio 2017, for instance, the output for the type const  char* is "char  const  * __ptr64"; with GCC 9 it is "PKc" (a mangled type name, short for "Pointer to Konst char")).

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Peter Van Weert and Marc Gregoire

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Van Weert, P., Gregoire, M. (2019). General Utilities. In: C++17 Standard Library Quick Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4923-9_2

Download citation

Publish with us

Policies and ethics