#include <xtd/xtd>
namespace examples {
class program {
public:
static auto main() {
auto numbers = stack<string> {};
numbers.push("one");
numbers.push("two");
numbers.push("three");
numbers.push("four");
numbers.push("five");
for (auto number : numbers)
console::write_line(number);
console::write_line("\nPopping '{}'", numbers.pop());
console::write_line("Peek at next item to destack: {}", numbers.peek());
console::write_line("Popping '{}'", numbers.pop());
auto stack2 = stack<string>(numbers.to_array());
console::write_line("\nContents of the first copy:");
for (auto number : stack2 )
console::write_line(number);
auto array2 = array<string>(numbers.count() * 2);
numbers.copy_to(array2, numbers.count());
auto stack3 = stack<string>(array2);
console::write_line("\nContents of the second copy, with duplicates and nulls:");
for (auto number : stack3 )
console::write_line(number);
console::write_line("\nstack2.contains(\"four\") = {0}", stack2.contains("four"));
console::write_line("\nstack2.clear()");
stack2.clear();
console::write_line("\nstack2.count() = {0}", stack2.count());
}
};
}
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:278