xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Typedefs
collections

Definition

collections definitions.

Typedefs

using xtd::collections::any_pair = std::pair< std::any, std::any >
 Implements a std::pair with the key and the value strongly typed to be std::any. More...
 
using xtd::collections::specialized::string_map = std::map< xtd::ustring, xtd::ustring >
 Implements a std::map with the key and the value strongly typed to be strings. More...
 
using xtd::collections::specialized::string_pair = std::pair< xtd::ustring, xtd::ustring >
 Implements a std::pair with the key and the value strongly typed to be strings. More...
 
using xtd::collections::specialized::string_vector = std::vector< xtd::ustring >
 Represents a collection of strings. More...
 
using xtd::collections::vector_list = std::vector< std::any >
 Represents a collection of std::any. More...
 

Typedef Documentation

◆ any_pair

using xtd::collections::any_pair = typedef std::pair<std::any, std::any>

#include <xtd.core/include/xtd/collections/any_pair.h>

Implements a std::pair with the key and the value strongly typed to be std::any.

Namespace
xtd::collections
Library
xtd.core

◆ string_map

#include <xtd.core/include/xtd/collections/specialized/string_map.h>

Implements a std::map with the key and the value strongly typed to be strings.

Namespace
xtd::collections
Library
xtd.core

◆ string_pair

#include <xtd.core/include/xtd/collections/specialized/string_pair.h>

Implements a std::pair with the key and the value strongly typed to be strings.

Namespace
xtd::collections
Library
xtd.core

◆ string_vector

#include <xtd.core/include/xtd/collections/specialized/string_vector.h>

Represents a collection of strings.

Namespace
xtd::collections
Library
xtd.core

◆ vector_list

using xtd::collections::vector_list = typedef std::vector<std::any>

#include <xtd.core/include/xtd/collections/vector_list.h>

Represents a collection of std::any.

Namespace
xtd::collections
Library
xtd.core
Examples
The following example shows hows to use xtd::collections::vector_list.
#include <xtd/xtd>
using namespace std;
using namespace std::literals;
using namespace xtd;
using namespace xtd::collections;
template<typename collection_t>
void print_values(const collection_t& my_list) {
for (auto obj : my_list)
console::write(" {0}", obj);
}
int main() {
// Creates and initializes a new vector_list.
vector_list my_vl;
my_vl.emplace_back("Hello"s);
my_vl.emplace_back("World"s);
my_vl.emplace_back("!"s);
// Displays the properties and values of the vector_list.
console::write_line(" size: {0}", my_vl.size());
console::write_line(" Capacity: {0}", my_vl.capacity());
console::write(" Values:");
print_values(my_vl);
}
// This code can produces the following output :
//
// my_vl
// size: 3
// Capacity: 4
// Values: Hello World !