luco::object class

the class that holds a luco object

Constructors, destructors, conversion operators

object() explicit
constructor for luco::object

Public functions

auto at(const std::string& key) →  class luco::node&
access specified key with bounds checking
auto begin() →  luco_object::iterator
returns an the first iterator
auto empty() const →  bool noexcept
check if the luco::object is empty
auto end() →  luco_object::iterator
returns an iterator past the last key
auto erase(const std::string& key) →  luco_object::size_type
remove a key with its associated node from the luco::object
auto erase(const luco_object::iterator pos) →  luco_object::iterator
remove an iterator with its associated node from the luco::object
auto erase(const luco_object::iterator begin, const luco_object::iterator end) →  luco_object::iterator
remove a range with its associated luco::node's from the luco::object
auto find(const std::string& key) →  luco_object::iterator
find a key
auto insert(const std::string& key, const class node& element) →  luco::node&
insert luco::node into key
auto operator[](const std::string& key) →  class luco::node&
access specified key without bounds checking or insert the key if it doesn't exist
auto size() const →  size_t noexcept
get the number of keys

Function documentation

class luco::node& luco::object::at(const std::string& key)

access specified key with bounds checking

Parameters
key to be accessed
Returns a reference to the luco::node associated to the key
Exceptions
std::out_of_range if the container doesn't have the key

luco_object::iterator luco::object::begin()

returns an the first iterator

Returns the first iterator

bool luco::object::empty() const noexcept

check if the luco::object is empty

Returns true if it is

luco_object::iterator luco::object::end()

returns an iterator past the last key

Returns iterator past the last key

luco_object::size_type luco::object::erase(const std::string& key)

remove a key with its associated node from the luco::object

Parameters
key the luco key to be removed
Returns number of keys removed

luco_object::iterator luco::object::erase(const luco_object::iterator pos)

remove an iterator with its associated node from the luco::object

Parameters
pos the iterator to be removed
Returns iterator following the last removed iterator

luco_object::iterator luco::object::erase(const luco_object::iterator begin, const luco_object::iterator end)

remove a range with its associated luco::node's from the luco::object

Parameters
begin the beginning of the range to be removed
end the end of the range to be removed
Returns iterator following the last removed iterator

luco_object::iterator luco::object::find(const std::string& key)

find a key

Returns iterator of the found key found or end()

luco::node& luco::object::insert(const std::string& key, const class node& element)

insert luco::node into key

Parameters
key the luco key to insert at
element the luco::node to be inserted
Returns a reference of the inserted luco::node

class luco::node& luco::object::operator[](const std::string& key)

access specified key without bounds checking or insert the key if it doesn't exist

Parameters
key to be accessed
Returns a reference to the luco::node associated to the key

size_t luco::object::size() const noexcept

get the number of keys

Returns the number of keys