This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
Tutorials

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: 2023-09-26
Build: ()