首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

utility

此标头是一般效用图书馆。

包括

*。

<初始化器[医]列表>%28C++11%29

命名空间

雷尔[医]操作系统提供自动比较操作符

在命名空间std::rel中定义[医]行动部

运算符%21=运算符>运算符<=操作符>=自动生成比较操作符,基于用户定义的运算符==和运算符<%28函数模板%29。

功能

交换两个对象的值%28函数模板%29

Exchange%28C++14%29用新值替换参数,并返回其先前的值%28函数模板%29

转发%28C++11%29转发函数参数%28函数模板%29

移动%28C++11%29获得rvalue引用%28函数模板%29

移动[医]如果[医]除%28C++11%29外,如果移动构造函数不抛出%28函数模板%29,则获得一个rvalue引用。

如[医]Const%28C++17%29获得对其参数%28函数模板%29的引用

Decval%28C++11%29获得对其参数的引用,以便用于未评估的上下文%28函数模板%29

制造[医]结对创建一个类型的对对象,由参数类型%28函数模板%29定义

运算符==运算符%21=运算符<运算符<=运算符>>=按字典顺序比较对%28函数模板%29中的值

交换%28std::PING%29%28C++11%29专门使用std::swp算法%28函数模板%29

获取%28std::PING%29%28C++11%29访问一对28函数模板%29的元素

到[医]chars%28c++17%29将整数或浮点值转换为字符序列%28函数%29。

从[医]字符%28C++17%29将字符序列转换为整数或浮点数值%28函数%29。

实现二进制元组,即一对值%28类模板%29

整型[医]序列%28C++14%29实现整数编译时序列%28类模板%29

炭[医]格式%28C++17%29指定std::to格式[医]Chars和STD::来自[医]碳数%28%29

帮手

分片[医]构造[医]T%28C++11%29标签类型用于为分段结构选择正确的函数重载%28class%29

分片[医]构造分段类型的对象%28C++11%29[医]构造[医]t用于消除分段构造函数的歧义%28常数%29

在[医]安放[医]位置[医]键入[医]位置[医]索引[医]位置[医]t in[医]位置[医]类型[医]t in[医]位置[医]指数[医]T%28C++17%29现场施工标签%28类模板%29

前向声明

元组%28C++11%29实现了固定大小的容器,它包含可能不同类型的元素%28class模板%29

简介

二次

代码语言:javascript
复制
#include <initializer_list>
namespace std {
  // operators:
  namespace rel_ops {
    template<class T> bool operator!=(const T&, const T&);
    template<class T> bool operator> (const T&, const T&);
    template<class T> bool operator<=(const T&, const T&);
    template<class T> bool operator>=(const T&, const T&);
  }
  // swap:
  template <class T>
  void swap(T& a, T& b) noexcept(/*see definition*/ );
  template <class T, size_t N>
  void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
 
  // exchange:
  template <class T, class U=T> T exchange(T& obj, U&& new_val);
 
  // forward/move:
  template <class T>
  constexpr T&& forward(remove_reference_t<T>& t) noexcept;
  template <class T>
  constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
  template <class T>
  constexpr remove_reference_t<T>&& move(T&&) noexcept;
  template <class T>
  constexpr conditional_t<!is_nothrow_move_constructible_v<T>
                          && is_copy_constructible_v<T>, const T&, T&&>
  move_if_noexcept(T& x) noexcept;
 
  // as_const:
  template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
  template <class T> void as_const(const T&&) = delete;
 
  // declval:
  template <class T>
  add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
 
  // Compile-time integer sequences
  template<class T, T...> struct integer_sequence;
  template<size_t... I>
  using index_sequence = integer_sequence<size_t, I...>;
  template<class T, T N>
  using make_integer_sequence = integer_sequence<T, /*see definition*/ >;
  template<size_t N>
  using make_index_sequence = make_integer_sequence<size_t, N>;
  template<class... T>
  using index_sequence_for = make_index_sequence<sizeof...(T)>;
 
  // pairs:
  template <class T1, class T2> struct pair;
 
  // pair specialized algorithms:
  template <class T1, class T2>
  constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
  template <class T1, class T2>
  constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
  template <class T1, class T2>
  constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
  template <class T1, class T2>
  constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
  template <class T1, class T2>
  constexpr bool operator>=(const pair<T1, T2>&, const pair<T1, T2>&);
  template <class T1, class T2>
  constexpr bool operator<=(const pair<T1, T2>&, const pair<T1, T2>&);
  template <class T1, class T2>
  void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
  template <class T1, class T2>
  constexpr /*see definition*/ make_pair(T1&&, T2&&);
 
  // tuple-like access to pair:
  template <class T> class tuple_size;
  template <size_t I, class T> class tuple_element;
  template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
  template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
  template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
  template<size_t I, class T1, class T2>
  constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>&) noexcept;
  template<size_t I, class T1, class T2>
  constexpr tuple_element_t<I, pair<T1, T2>>&& get(pair<T1, T2>&&) noexcept;
  template<size_t I, class T1, class T2>
  constexpr const tuple_element_t<I, pair<T1, T2>>& get(const pair<T1, T2>&) noexcept;
  template<size_t I, class T1, class T2>
  constexpr const tuple_element_t<I, pair<T1, T2>>&& get(const pair<T1, T2>&&) noexcept;
  template <class T, class U>
  constexpr T& get(pair<T, U>& p) noexcept;
  template <class T, class U>
  constexpr const T& get(const pair<T, U>& p) noexcept;
  template <class T, class U>
  constexpr T&& get(pair<T, U>&& p) noexcept;
  template <class T, class U>
  constexpr const T&& get(const pair<T, U>&& p) noexcept;
  template <class T, class U>
  constexpr T& get(pair<U, T>& p) noexcept;
  template <class T, class U>
  constexpr const T& get(const pair<U, T>& p) noexcept;
  template <class T, class U>
  constexpr T&& get(pair<U, T>&& p) noexcept;
  template <class T, class U>
  constexpr const T&& get(const pair<U, T>&& p) noexcept;
 
  // pair piecewise construction
  struct piecewise_construct_t { };
  constexpr piecewise_construct_t piecewise_construct{};
  template <class... Types> class tuple; // defined in <tuple>
 
  // in-place construction
  struct in_place_t { explicit in_place_t() = default; };
  inline constexpr in_place_t in_place{};
  template <class T>
  struct in_place_type_t { explicit in_place_type_t() = default; };
  template <class T>
  inline constexpr in_place_type_t<T> in_place_type{};
  template <size_t I>
  struct in_place_index_t { explicit in_place_index_t() = default; };
  template <size_t I>
  inline constexpr in_place_index_t<I> in_place_index{};
  // floating-point format for primitive numerical conversion
  enum class chars_format {
    scientific = /*unspecified*/ ,
    fixed = /*unspecified*/ ,
    hex = /*unspecified*/ ,
    general = fixed | scientific
  };
  // primitive numerical output conversion
  struct to_chars_result {
    char* ptr;
    error_code ec;
  };
  to_chars_result to_chars(char* first, char* last, see below value, int base = 10);
  to_chars_result to_chars(char* first, char* last, float value);
  to_chars_result to_chars(char* first, char* last, double value);
  to_chars_result to_chars(char* first, char* last, long double value);
  to_chars_result to_chars(char* first, char* last, float value, chars_format fmt);
  to_chars_result to_chars(char* first, char* last, double value, chars_format fmt);
  to_chars_result to_chars(char* first, char* last, long double value, chars_format fmt);
  to_chars_result to_chars(char* first, char* last, float value,
                           chars_format fmt, int precision);
  to_chars_result to_chars(char* first, char* last, double value,
                           chars_format fmt, int precision);
  to_chars_result to_chars(char* first, char* last, long double value,
                           chars_format fmt, int precision);
  // primitive numerical input conversion
  struct from_chars_result {
    const char* ptr;
    error_code ec;
  };
  from_chars_result from_chars(const char* first, const char* last,
                               /*see description*/ & value, int base = 10);
  from_chars_result from_chars(const char* first, const char* last, float& value,
                               chars_format fmt = chars_format::general);
  from_chars_result from_chars(const char* first, const char* last, double& value,
                               chars_format fmt = chars_format::general);
  from_chars_result from_chars(const char* first, const char* last, long double& value,
                               chars_format fmt = chars_format::general);
}

二次

类模板std::integer_sequence

二次

代码语言:javascript
复制
namespace std {
  template<class T, T... I>
  struct integer_sequence {
    using value_type = T;
    static constexpr size_t size() noexcept { return sizeof...(I); }
  };
}

二次

std::pair

二次

代码语言:javascript
复制
namespace std {
  template <class T1, class T2>
  struct pair {
    using first_type = T1;
    using second_type = T2;
    T1 first;
    T2 second;
    pair(const pair&) = default;
    pair(pair&&) = default;
    constexpr pair();
    /*conditionally-explicit*/ constexpr pair(const T1& x, const T2& y);
    template<class U, class V>
    /*conditionally-explicit*/  constexpr pair(U&& x, V&& y);
    template<class U, class V>
    /*conditionally-explicit*/  constexpr pair(const pair<U, V>& p);
    template<class U, class V>
    /*conditionally-explicit*/  constexpr pair(pair<U, V>&& p);
    template <class... Args1, class... Args2>
    pair(piecewise_construct_t, tuple<Args1...> first_args, tuple<Args2...> second_args);
    pair& operator=(const pair& p);
    template<class U, class V> pair& operator=(const pair<U, V>& p);
    pair& operator=(pair&& p) noexcept(/*see definition*/ );
    template<class U, class V> pair& operator=(pair<U, V>&& p);
    void swap(pair& p) noexcept(/*see definition*/);
  };
}

二次

另见

<tuple>

Defines std::tuple

实用程序库

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com