Skip to content

Commit ac40522

Browse files
committed
add at() for compatability
1 parent 588ff60 commit ac40522

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ option(INSTALL_ONLY "Enable for installation only" OFF)
1010
# Note: update this to your new project's name and version
1111
project(
1212
Py2Cpp
13-
VERSION 1.4.4
13+
VERSION 1.4.5
1414
LANGUAGES CXX
1515
)
1616

include/py2cpp/dict.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ class dict : public std::unordered_map<Key, T> {
131131
return this->at(k); // luk: a bug in std::unordered_map?
132132
}
133133

134+
/**
135+
* @brief
136+
*
137+
* @return _Self&
138+
*/
139+
auto at(const Key &k) const -> const T & {
140+
return this->at(k); // luk: a bug in std::unordered_map?
141+
}
142+
134143
/**
135144
* @brief
136145
*

include/py2cpp/lict.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ template <typename T> class Lict {
4747
*/
4848
const T &operator[](const key_type &key) const { return this->_lst[key]; }
4949

50+
/**
51+
* @brief
52+
*
53+
* @param key
54+
* @return const T&
55+
*/
56+
const T &at(const key_type &key) const { return this->_lst.at(key); }
57+
5058
// void erase() { throw std::runtime_error("NotImplementedError"); }
5159

5260
/**

0 commit comments

Comments
 (0)