void dump_as_list(const int fd) final { std::vector<element_type> v; v.reserve(m_elements.size()); for (const auto& element : m_elements) { v.emplace_back(element.first, element.second); } std::sort(v.begin(), v.end()); osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(v.data()), sizeof(element_type) * v.size()); }
/*! Parameter "starting_point" desingates where the numbering begins. * A starting_point of zero will start the numbering at zero * (Sun=0, Mon=1, ...) were a starting_point of one starts the * numbering at one (Jan=1, Feb=2, ...). The default is zero, * negative vaules are not allowed */ string_parse_tree(collection_type names, unsigned int starting_point=0) { // iterate thru all the elements and build the tree unsigned short index = 0; while (index != names.size() ) { string_type s = boost::algorithm::to_lower_copy(names[index]); insert(s, static_cast<unsigned short>(index + starting_point)); index++; } //set the last tree node = index+1 indicating a value index++; }
/** * Make room for one item. * * Tries to ensure that a new item can be added to the container. * * @return true if there is room for a new item, false if resource limit is reached. */ bool ensure_capacity() { size_type size = collection_.size(); size_type cap = collection_.capacity(); if (size == cap) { // collection is full, check resource limit if (cap < configuration_.maximum) { // increase collection capacity assert(configuration_.increment > 0); cap += configuration_.increment; cap = std::min(cap, configuration_.maximum); collection_.reserve(cap); } else { return false; } } return true; }
size_t used_memory() const final { return element_size * m_elements.size(); }
size_t size() const final { return m_elements.size(); }
size_t size() const override final { return m_elements.size(); }