Add const to get method

This commit is contained in:
fbraem 2013-02-19 22:32:40 +01:00
parent 79c1edbdfb
commit a39b33b3e9
2 changed files with 4 additions and 4 deletions

View File

@ -116,7 +116,7 @@ public:
template<typename T>
T get(const std::string& name)
T get(const std::string& name) const
/// Returns the element with the given name and tries to convert
/// it to the template type. When the element is not found, a
/// NotFoundException will be thrown. When the element can't be
@ -141,7 +141,7 @@ public:
}
}
Element::Ptr get(const std::string& name);
Element::Ptr get(const std::string& name) const;
/// Returns the element with the given name.
/// An empty element will be returned when the element is not found.

View File

@ -59,11 +59,11 @@ Document::~Document()
}
Element::Ptr Document::get(const std::string& name)
Element::Ptr Document::get(const std::string& name) const
{
Element::Ptr element;
ElementSet::iterator it = std::find_if(_elements.begin(), _elements.end(), ElementFindByName(name));
ElementSet::const_iterator it = std::find_if(_elements.begin(), _elements.end(), ElementFindByName(name));
if ( it != _elements.end() )
{
return *it;