Hey guys, I have what I would consider a fairly unique problem. I'm not even sure where to start looking for a solution. I have template class that uses a typedef to define a map. But when I go to make an iterator for that map, I get a compile errors. Here's my class (it's fairly simple):
template<class S>
class RangeValidatorDependency : public Dependency{
public:
typedef std::map<std::pair<S,S>, Teuchos::RCP<const Teuchos::ParameterEntryValidator> > RangeToValidatorMap;
RangeValidatorDependency(std::string dependent, std::string dependee, RangeToValidatorMap rangesAndValidators,
Teuchos::RCP<const Teuchos::ParameterEntryValidator> defaultValidator)
:Dependency(dependent, dependee, Dependency::RangeValiDep)
{
this->defaultValidator = defaultValidator;
this->rangesAndValidators = rangesAndValidators;
}
virtual Teuchos::RCP<const Teuchos::ParameterEntryValidator> getValidatorFor(S value) const{
RangeToValidatorMap::const_iterator it;
for(it = rangesAndValidators.begin(); it != rangesAndValidators.end(); it++){
S min = it->first.first;
S max = it->first.second;
if(value >= min && value <=max)
return it->second;
}
return defaultValidator;
}
private:
Teuchos::RCP<const Teuchos::ParameterEntryValidator> defaultValidator;
RangeToValidatorMap rangesAndValidators;
};
The problem occurs on this line
RangeToValidatorMap::const_iterator it;
This is the compile error I get.
TivaBuena_StandardDependencies.hpp:16: error: expected `;' before ‘it’
I'm not sure what to do. Anyone know what the problem is?