GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
ChaiScript_Language::Vector Class Reference

A vector of Objects. More...

#include <chaiscript_prelude_docs.hpp>

Public Member Functions

Object operator[] (int t_index)
 returns the Object at the given index. Throws an exception if the index does not exist
const Object operator[] (int t_index) const
 returns a const Object at the given index. Throws an exception if the index does not exist.
Object back ()
 returns the last item in the Vector
void clear ()
 Clears the Vector of all items.
bool empty ()
 Returns true if the Vector is contains 0 items.
void erase_at (int t_index)
 Erases the element at the given index.
Object front ()
 Returns the first item in the Vector.
void insert_ref_at (int, Object)
 Inserts a new item in the Vector at the given index. The item is not cloned on insert.
void insert_at (int, Object)
 Inserts a new item in the Vector at the given index. The item is cloned on insert.
void pop_back ()
 Removes the last item from the Vector.
void push_back_ref (Object)
 Adds an item to the end of the Vector. The item is not cloned.
void push_back (Object)
 Adds an item to the end of the Vector. The item is cloned.
Range range ()
 Returns a Range object for the entire vector.
Const_Range range () const
 Returns a Const_Range object for the entire vector.
int size () const
 Returns the number of elements in the Vector.

Detailed Description

A vector of Objects.

ChaiScript includes a shortcut for creating a Vector of Objects

Example:

eval> var v = [1,2,3,4]
[1, 2, 3, 4]
eval> v[0];
1
eval> v.size();
4

Implemented with std::vector<chaiscript::Boxed_Value>

See also
chaiscript::bootstrap::standard_library::vector_type

Member Function Documentation

◆ back()

Object ChaiScript_Language::Vector::back ( )

returns the last item in the Vector

◆ clear()

void ChaiScript_Language::Vector::clear ( )

Clears the Vector of all items.

◆ empty()

bool ChaiScript_Language::Vector::empty ( )

Returns true if the Vector is contains 0 items.

◆ erase_at()

void ChaiScript_Language::Vector::erase_at ( int t_index)

Erases the element at the given index.

◆ front()

Object ChaiScript_Language::Vector::front ( )

Returns the first item in the Vector.

◆ insert_at()

void ChaiScript_Language::Vector::insert_at ( int ,
Object  )

Inserts a new item in the Vector at the given index. The item is cloned on insert.

See also
insert_ref

◆ insert_ref_at()

void ChaiScript_Language::Vector::insert_ref_at ( int ,
Object  )

Inserts a new item in the Vector at the given index. The item is not cloned on insert.

See also
insert_ref

◆ operator[]() [1/2]

Object ChaiScript_Language::Vector::operator[] ( int t_index)

returns the Object at the given index. Throws an exception if the index does not exist

◆ operator[]() [2/2]

const Object ChaiScript_Language::Vector::operator[] ( int t_index) const

returns a const Object at the given index. Throws an exception if the index does not exist.

◆ pop_back()

void ChaiScript_Language::Vector::pop_back ( )

Removes the last item from the Vector.

◆ push_back()

void ChaiScript_Language::Vector::push_back ( Object )

Adds an item to the end of the Vector. The item is cloned.

See also
push_back_ref

◆ push_back_ref()

void ChaiScript_Language::Vector::push_back_ref ( Object )

Adds an item to the end of the Vector. The item is not cloned.

See also
push_back

◆ range() [1/2]

Range ChaiScript_Language::Vector::range ( )

Returns a Range object for the entire vector.

◆ range() [2/2]

Const_Range ChaiScript_Language::Vector::range ( ) const

Returns a Const_Range object for the entire vector.

◆ size()

int ChaiScript_Language::Vector::size ( ) const

Returns the number of elements in the Vector.


The documentation for this class was generated from the following file: