google / google/leveldb

Question: how to cast to int

Open
#1,203 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

Hi, I have following map

```cpp
std::map db;
```

which in future, I want load data from leveldb to the memory by looping all of keys and insert to the std::map, I was do this
```cpp
leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());

for (it->SeekToFirst(); it->Valid(); it->Next()) {
db.insert(
{
it->key().ToString(),
it->value()
}
);
}
assert(it->status().ok());
```

which get the key as string, then get the value. my question how do I can cast back the "value" to int?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.