Commit 7e78beaa authored by rmrf's avatar rmrf
Browse files

Start converting to range-based for-loops.

parent a95a42e6
#ifndef _FIND_TYPE_H_
#define _FIND_TYPE_H_
#ifndef _FIND_TEMPLATE_TYPES_H_
#define _FIND_TEMPLATE_TYPES_H_
#include <set>
#include <vector>
......@@ -28,7 +28,7 @@ namespace scpar {
/// Copy constructor
FindTemplateTypes( const FindTemplateTypes &rhs ) {
copy (rhs._templateTypes.begin (), rhs._templateTypes.end (),
copy (rhs._templateTypes.begin(), rhs._templateTypes.end(),
back_inserter (_templateTypes) );
}
......@@ -36,12 +36,13 @@ namespace scpar {
string s{};
// type_vector_t::iterator
for (auto mit = _templateTypes.begin (); mit != _templateTypes.end (); ++mit) {
if (mit != _templateTypes.begin()) {
for (auto mit = _templateTypes.begin (); mit != _templateTypes.end (); ++mit) {
//for ( auto const &mit: _templateTypes ) {
if ( mit != _templateTypes.begin() ) {
s += "<";
}
s += mit->first;
if (mit != _templateTypes.begin()) {
if ( mit != _templateTypes.begin() ) {
s += ">";
}
}
......@@ -91,27 +92,36 @@ namespace scpar {
}
void printTemplateArguments( llvm::raw_ostream &os, int tabn = 0 ) {
vector < string > template_arguments{ getTemplateArguments() };
// type_vector_t::iterator
for (auto mit = _templateTypes.begin(); mit != _templateTypes.end(); mit++) {
for ( auto i{0}; i < tabn; ++i) {
os << " ";
}
os << "- " << mit->first << ", type ptr: " << mit->second;
os << "\n";
}
// for (auto mit = _templateTypes.begin(); mit != _templateTypes.end(); mit++) {
// for ( auto const &mit: _templateTypes ) {
/* for ( auto i{0}; i < tabn; ++i) { */
/* os << " "; */
/* } */
/* os << "- " << mit.first << ", type ptr: " << mit.second; */
/* os << "\n"; */
// template_arguments.push_back( mit.first );
// }
// Print the template arguments to the output stream
os << "= ";
for ( auto const &targ: template_arguments ) {
os << targ << " ";
}
}
vector < string > getTemplateArguments() {
vector < string > args;
vector < string > template_arguments;
// type_vector_t::iterator
for ( auto mit = _templateTypes.begin(); mit != _templateTypes.end(); ++mit ) {
if ( mit->first == "sc_in" || mit->first == "sc_out" || mit->first == "sc_inout" ) {
// for ( auto mit = _templateTypes.begin(); mit != _templateTypes.end(); ++mit ) {
for ( auto const &mit: _templateTypes ) {
if ( mit.first == "sc_in" || mit.first == "sc_out" || mit.first == "sc_inout" ) {
break;
}
args.push_back(mit->first);
template_arguments.push_back( mit.first );
}
return args;
return template_arguments;
}
size_t size() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment