ChaiScript
Public Member Functions | List of all members
ChaiScript_Language::Map Class Reference

Maps strings to Objects. More...

#include <chaiscript_prelude_docs.hpp>

Public Member Functions

Range range ()
 Returns an object that implements the Range concept for the Map_Pair's in this Map.
 
Const_Range range () const
 Returns an object that implements the Const_Range concept for the Map_Pair's in this Map.
 
int size () const
 Returns the number of elements in the Map.
 
Object operator[] (string)
 Returns the item at the given key, creating an undefined Object if the key does not yet exist in the map.
 
void clear ()
 Clears the map of all items.
 
int count (string) const
 Returns the number of items in the Map with the given key. Returns 0 or 1 since this is not an std::multimap.
 
bool empty () const
 Returns true if the map contains no items.
 

Detailed Description

Maps strings to Objects.

ChaiScript has a built in shortcut for generating Map objects:

Example:

eval> var m = ["a":1, "b":2];
[<a,1>, <b,2>]
eval> m.count("a");
1
eval> m.count("c");
0
eval> m.size();
2

Implemented as std::map<Boxed_Value>

See also
Map_Pair
chaiscript::bootstrap::standard_library::map_type

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