Construct version 5.4.4
An agent based modeling framework
dynet::ParameterMap Struct Reference

More...

Inherits std::unordered_map< std::string, std::string >.

Public Member Functions

const std::string & get_parameter (const std::string &parameter_key) const
 Gets a parameter in the ParameterMap. More...
 

Detailed Description

Member Function Documentation

◆ get_parameter()

const std::string & dynet::ParameterMap::get_parameter ( const std::string &  parameter_key) const

Gets a parameter in the ParameterMap.

Parameters
parameter_keyThe key for the desired parameter.
Returns
Returns the value of the desired parameter.

Example

int main()
{
dynet::ParameterMap parameters;
parameters["param 1"] = "param 1";
parameters["param 2"] = "value 2";
std::cout << parameters.get_parameter("param 1") << dynet::endl;
// exception gets thrown
std::cout << parameters.get_parameter("param 3") << dynet::endl;
}
Definition: utils.h:87
const std::string & get_parameter(const std::string &parameter_key) const
Gets a parameter in the ParameterMap.

Output:

param 1

Complexity

Constant.

Iterator validity

No changes.

Exception Safety

A dynet::could_not_find_parameter exception is thrown if the parameter key was not found in the data structure.

Here is the caller graph for this function: