This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine::Set Class

Header: #include <UnigineSet.h>

A set is a container template in which each element must be unique as the value of the element identifies it. The values are stored in the ascending order.

To create a new set, you can use the default constructor or one of the following ways:

  • Create a new set by using the constructor with an initializer list:
    Source code (C++)
    const Set<int> my_set{ 1, 6, 4, 3, 7 };
    
    // check the result
    for (const auto &it : my_set)
    	Log::message("%d ", it.key);
  • Create a new set using a copy constructor:
    Source code (C++)
    // constructor that takes an initializer list
    const Set<String> initial{ "a", "e" };
    // copy constructor
    const Set<String> copied(initial);
    // check the result
    for (const auto &it : copied)
    	Log::message("%s ", it.key.get());

Also you can modify a set by using the append() and insert() class member functions. Check some of the usage examples:

  • Create a new set and append elements to it one by one:
    Source code (C++)
    Set<int> my_set;
    
    my_set.append(1);
    my_set.append(10);
    my_set.append(4);
    
    // check the result
    for (const auto &it : my_set)
    	Log::message("%d ", it.key);
  • Create a new set and append another set to it:
    Source code (C++)
    // create a set using an initializer list
    const Set<int> my_set_0{ 1, 6, 4, 3, 7 };
    
    // declare a new set
    Set<int> my_set_1;
    // append the "my_set_0" to it
    my_set_1.append(my_set_0);
    
    // check the result
    for (const auto &it : my_set)
    	Log::message("%d ", it.key);
  • Modify the existing set that already contains elements:
    Notice
    If an element already exists in the initial set, it will not be added.
    Source code (C++)
    // create sets using initializer lists
    Set<String> initial{ "a", "b", "c", "d", "e" };
    Set<String> to_add{ "m", "n", "o" };
    
    // append keys of the "to_add" set to the "initial" set
    initial.append(to_add);
    // insert a key into the "initial" set
    initial.insert("s");
    
    // check the result
    for (const auto &it : initial)
    	Log::message("%s ", it.key.get());

Set Class

Members


Set ( ) #

Default constructor that produces an empty set.

Set ( std::initializer_list<Key> list ) #

Constructor. Creates a set from keys of the giving list.

Arguments

  • std::initializer_list<Key> list - List of keys.

Set ( Set<Key, Allocator> && o ) #

Constructor. Creates a set by copying a source set.

Arguments

  • Set<Key, Allocator> && o - Source set.

Set ( const Set<Key, Allocator> & o ) #

Constructor. Creates a set by copying a source set.

Arguments

  • const Set<Key, Allocator> & o - Source set.

void append ( const Key & key ) #

Appends a key.

Arguments

  • const Key & key - Key.

void append ( Key && key ) #

Appends a key.

Arguments

  • Key && key - Key.

void insert ( Key && key ) #

Inserts a given key into the set.

Arguments

  • Key && key - Key.

void insert ( const Key & key ) #

Inserts a given key into the set.

Arguments

  • const Key & key - Key.

Set<Key, Allocator> & operator= ( const Set<Key, Allocator> & o ) #

Assignment operator for the set.

Arguments

  • const Set<Key, Allocator> & o - Set.

Set<Key, Allocator> & operator= ( Set<Key, Allocator> && o ) #

Assignment operator for the set.

Arguments

  • Set<Key, Allocator> && o - Set.

void append ( const Set<Key, Allocator> & s ) #

Appends a given set to the current one.

Arguments

  • const Set<Key, Allocator> & s - Set.

void append ( Set<Key, Allocator> && s ) #

Appends a given set to the current one.

Arguments

  • Set<Key, Allocator> && s - Set.

void insert ( const Set<Key, Allocator> & o ) #

Inserts a given set into the current one.

Arguments

  • const Set<Key, Allocator> & o - Set.

void insert ( Set<Key, Allocator> && o ) #

Inserts a given set into the current one.

Arguments

  • Set<Key, Allocator> && o - Set.
Last update: 26.09.2023
Build: ()