GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::raw_storage_iterator(3) C++ Standard Libary std::raw_storage_iterator(3)

std::raw_storage_iterator - std::raw_storage_iterator


Defined in header <memory>
template< class OutputIt, class T >


class raw_storage_iterator (until C++17)


: public std::iterator<std::output_iterator_tag, void, void,
void, void>;
template< class OutputIt, class T > (since C++17)
class raw_storage_iterator; (deprecated)
(removed in C++20)


The output iterator std::raw_storage_iterator makes it possible for standard
algorithms to store results in uninitialized memory. Whenever the algorithm writes
an object of type T to the dereferenced iterator, the object is copy-constructed
into the location in the uninitialized storage pointed to by the iterator. The
template parameter OutputIt is any type that meets the requirements of
LegacyOutputIterator and has operator* defined to return an object, for which
operator& returns an object of type T*. Usually, the type T* is used as OutputIt.


-
OutputIt must meet the requirements of LegacyOutputIterator.


constructor creates a new raw_storage_iterator
(public member function)
operator= constructs an object at the pointed-to location in the buffer
(public member function)
operator* dereferences the iterator
(public member function)
operator++ advances the iterator
operator++(int) (public member function)
base provides access to the wrapped iterator
(since C++17) (public member function)


Member type Definition
iterator_category std::output_iterator_tag
value_type void
difference_type void (until C++20)
std::ptrdiff_t (since C++20)
pointer void
reference void


Member types iterator_category, value_type, difference_type, pointer
and reference are required to be obtained by inheriting from (until C++17)
std::iterator<std::output_iterator_tag, void, void, void, void>.

// Run this code


#include <iostream>
#include <string>
#include <memory>
#include <algorithm>


int main()
{
const std::string s[] = {"This", "is", "a", "test", "."};
std::string* p = std::allocator<std::string>().allocate(5);


std::copy(std::begin(s), std::end(s),
std::raw_storage_iterator<std::string*, std::string>(p));


for(std::string* i = p; i!=p+5; ++i) {
std::cout << *i << '\n';
i->~basic_string<char>();
}
std::allocator<std::string>().deallocate(p, 5);
}


This
is
a
test
.


allocator_traits provides information about allocator types
(C++11) (class template)
scoped_allocator_adaptor implements multi-level allocator for multi-level containers
(C++11) (class template)
uses_allocator checks if the specified type supports uses-allocator
(C++11) construction
(class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.