+ check if index is valid in to_string()
+ output feature id
This commit is contained in:
parent
16828ec161
commit
ff66cc1326
1 changed files with 6 additions and 2 deletions
|
@ -254,12 +254,16 @@ public:
|
|||
std::string to_string() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Feature (" << std::endl;
|
||||
ss << "Feature ( id=" << id_ << std::endl;
|
||||
context_type::map_type::const_iterator itr = ctx_->mapping_.begin();
|
||||
context_type::map_type::const_iterator end = ctx_->mapping_.end();
|
||||
for ( ;itr!=end; ++itr)
|
||||
{
|
||||
ss << " " << itr->first << ":" << data_[itr->second] << std::endl;
|
||||
std::size_t index = itr->second;
|
||||
if (index < data_.size())
|
||||
{
|
||||
ss << " " << itr->first << ":" << data_[itr->second] << std::endl;
|
||||
}
|
||||
}
|
||||
ss << ")" << std::endl;
|
||||
return ss.str();
|
||||
|
|
Loading…
Reference in a new issue