47 std::unique_ptr<int>
ptr;
60 ptr = f.
ptr ? std::make_unique<int>(*f.
ptr) :
nullptr;
76 requires std::convertible_to<T, int>
79 cout <<
"capacity = " << s.
capacity() << endl
80 <<
"size = " << s.
size() << endl;
82 for (
size_t i = 0; i < s.
size(); ++i)
92 requires std::constructible_from<T, int>
97 for (
int i = 0; i < n; ++i)
103int main(
int argc,
char * argv[])
112 try { n = stoi(argv[1]); }
113 catch (
const std::invalid_argument &) { n = 1000; }
114 catch (
const std::out_of_range &) { n = 1000; }
118 for (
int i = 0; i < n; ++i)
126 try {
m = stoi(argv[2]); }
127 catch (
const std::invalid_argument &) {
m = n / 4; }
128 catch (
const std::out_of_range &) {
m = n / 4; }
132 cout <<
"Extracting " <<
m <<
" items" << endl;
133 for (
int i = 0; i <
m; ++i)
134 cout << s.
get() <<
" ";
143 print(create_memarray<int>(n));
145 print(create_memarray<Foo>(n));
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
Simple, scalable and fast dynamic array.
T & put(const T &item)
Put a copy of item at the end of the sequence.
size_t size() const noexcept
Return the number of elements.
T get(const size_t i=1)
Remove i elements from the end.
constexpr size_t capacity() const noexcept
The type of element of array.
Main namespace for Aleph-w library functions.
std::decay_t< typename HeadC::Item_Type > T
std::unique_ptr< int > ptr
Foo(Foo &&f) noexcept=default
Foo & operator=(const Foo &f)
void print(const MemArray< T > &s)
MemArray< T > create_memarray(int n)
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)
Simple, scalable, contiguous dynamic array.