Here in this article, the guy is writing an STL compatible prefix tree.
Then we have the selectors and mutators.
/* Selectors */ const_iterator find(const key_type& key) const; size_type size() const; size_type max_size() const; bool empty() const; reference at(const key_type& key); const_reference at(const key_type& key) const; /* Mutators */ iterator find(const key_type& key); std::pair<iterator, bool> insert(const key_type& key, const mapped_type& value); std::pair<iterator, bool> insert(const value_type& value); iterator insert(const_iterator hint, const value_type& value); reference operator[] (const key_type& key); void erase(const key_type& key); iterator erase(iterator pos); void clear();
I though first that they are something like setters
and getters
. the selectors
get some data stored inside or about the container, and the mutators
mutate the state of the container. But looks like it's a bit different. for example, there is a selector function called at
that returns a non-const reference type (I think this way the content of the container can be changed). What is the difinition of Selectors
and Mutators
?