File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -692,6 +692,23 @@ class svector {
692692 [[nodiscard]] auto data () const -> T const * {
693693 return const_cast <svector*>(this )->data (); // NOLINT(cppcoreguidelines-pro-type-const-cast)
694694 }
695+
696+ // Danger: only use when you know size() < capacity() ahead of time
697+ template <class ... Args>
698+ auto emplace_back_unchecked (Args&&... args) -> T& {
699+ T* ptr; // NOLINT(cppcoreguidelines-init-variables)
700+ size_t s; // NOLINT(cppcoreguidelines-init-variables)
701+ if (is_dir) {
702+ s = size<direction::direct>();
703+ ptr = data<direction::direct>() + s;
704+ set_size<direction::direct>(s + 1 );
705+ } else {
706+ s = size<direction::indirect>();
707+ ptr = data<direction::indirect>() + s;
708+ set_size<direction::indirect>(s + 1 );
709+ }
710+ return *new (static_cast <void *>(ptr)) T (std::forward<Args>(args)...);
711+ }
695712
696713 template <class ... Args>
697714 auto emplace_back (Args&&... args) -> T& {
You can’t perform that action at this time.
0 commit comments