Procedurally generate EnumerableSet and EnumerableMap (#3429)
This commit is contained in:
@ -30,7 +30,7 @@ import "./EnumerableSet.sol";
|
||||
*
|
||||
* - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
|
||||
* - `address -> uint256` (`AddressToUintMap`) since v4.6.0
|
||||
* - `bytes32 -> bytes32` (`Bytes32ToBytes32`) since v4.6.0
|
||||
* - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
|
||||
* - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
|
||||
* - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
|
||||
*
|
||||
@ -116,7 +116,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* Does not revert if `key` is not in the map.
|
||||
*/
|
||||
function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
|
||||
@ -129,7 +129,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
@ -216,7 +216,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* Does not revert if `key` is not in the map.
|
||||
*/
|
||||
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
|
||||
@ -225,7 +225,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
@ -308,10 +308,8 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* Does not revert if `key` is not in the map.
|
||||
*
|
||||
* _Available since v3.4._
|
||||
*/
|
||||
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
|
||||
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
|
||||
@ -319,7 +317,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
@ -402,7 +400,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* Does not revert if `key` is not in the map.
|
||||
*/
|
||||
function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
|
||||
@ -411,7 +409,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
@ -494,7 +492,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* @dev Tries to returns the value associated with `key`. O(1).
|
||||
* Does not revert if `key` is not in the map.
|
||||
*/
|
||||
function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
|
||||
@ -503,7 +501,7 @@ library EnumerableMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
* @dev Returns the value associated with `key`. O(1).
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user