Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::list<T,Allocator>::emplace_front

      From cppreference.com
      <cpp‎ |container‎ |list

      [edit template]
       
       
       
      std::list
      Member functions
      Non-member functions
      (until C++20)(until C++20)(until C++20)(until C++20)(until C++20)
      Deduction guides(C++17)
       
      template<class...Args>
      void emplace_front( Args&&...args);
      (since C++11)
      (until C++17)
      template<class...Args>
      reference emplace_front( Args&&...args);
      (since C++17)
      (constexpr since C++26)

      Inserts a new element to the beginning of the container. The element is constructed throughstd::allocator_traits::construct, which typically uses placementnew to construct the element in-place at the location provided by the container. The argumentsargs... are forwarded to the constructor asstd::forward<Args>(args)....

      No iterators or references are invalidated.

      Contents

      [edit]Parameters

      args - arguments to forward to the constructor of the element
      Type requirements
      -
      IfT is notEmplaceConstructible intolist fromargs..., the behavior is undefined.

      [edit]Return value

      (none)(until C++17)
      A reference to the inserted element.(since C++17)

      [edit]Complexity

      Constant.

      [edit]Exceptions

      If an exception is thrown for any reason, this function has no effect (strong exception safety guarantee).

      [edit]See also

      inserts an element to the beginning
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/list/emplace_front&oldid=135224"

      [8]ページ先頭

      ©2009-2025 Movatter.jp