problemscpp
A collection of my answers to algorithm problems in c++.
Public 成员函数 | Private 属性 | 所有成员列表
leetcode::time_based_key_value_store::TimeMap类 参考

#include <leetcode.h>

Public 成员函数

 TimeMap ()=default
 初始化数据结构对象 更多...
 
string get (const string &key, int timestamp)
 返回先前调用 set(key, value, timestamp_prev) 所存储的值,其中 timestamp_prev <= timestamp 。 更多...
 
void set (const string &key, string value, int timestamp)
 存储键 key、值 value,以及给定的时间戳 timestamp。 更多...
 

Private 属性

unordered_map< string, map< int, string, greater< int > > > um
 

详细描述

在文件 leetcode.h3301 行定义.

构造及析构函数说明

◆ TimeMap()

leetcode::time_based_key_value_store::TimeMap::TimeMap ( )
default

初始化数据结构对象

成员函数说明

◆ get()

string leetcode::time_based_key_value_store::TimeMap::get ( const string &  key,
int  timestamp 
)

返回先前调用 set(key, value, timestamp_prev) 所存储的值,其中 timestamp_prev <= timestamp 。

在文件 leetcode.cpp9419 行定义.

9419 {
9420 const auto it = um[key].lower_bound(timestamp);
9421 return it == um[key].end() ? "" : it->second;
9422 }
unordered_map< string, map< int, string, greater< int > > > um
Definition: leetcode.h:3302

引用了 um.

◆ set()

void leetcode::time_based_key_value_store::TimeMap::set ( const string &  key,
string  value,
int  timestamp 
)

存储键 key、值 value,以及给定的时间戳 timestamp。

在文件 leetcode.cpp9417 行定义.

9417{ um[key][timestamp] = std::move(value); }

引用了 um.

类成员变量说明

◆ um

unordered_map<string, map<int, string, greater<int> > > leetcode::time_based_key_value_store::TimeMap::um
private

在文件 leetcode.h3302 行定义.

被这些函数引用 get() , 以及 set().


该类的文档由以下文件生成: