xtd - Reference Guide 0.2.0
collections

Definition

collections definitions.

Collaboration diagram for collections:

Classes

class  xtd::forms::layout::arranged_element_collection< type_t, sorter_t >
 Represents a collection of objects. More...
 

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.

using any_pair = std::pair<std::any, 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.

using string_map = std::map<xtd::ustring, xtd::ustring>
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.

using string_pair = std::pair<xtd::ustring, xtd::ustring>
Namespace
xtd::collections
Library
xtd.core

◆ string_vector

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

Represents a collection of strings.

using string_vector = std::vector<xtd::ustring>
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.

using vector_list = std::vector<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");
my_vl.emplace_back("World");
my_vl.emplace_back("!");
// 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 !