Replaced BOOSE_FOREACH with for in wrap folder. Tested the changed code locally: successful.

release/4.3a0
Yao Chen 2016-05-20 21:41:18 -04:00
parent a464769ce1
commit d1ea1015a9
13 changed files with 61 additions and 72 deletions

View File

@ -18,7 +18,6 @@
#include "Argument.h"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
@ -40,7 +39,7 @@ Argument Argument::expandTemplate(const TemplateSubstitution& ts) const {
ArgumentList ArgumentList::expandTemplate(
const TemplateSubstitution& ts) const {
ArgumentList instArgList;
BOOST_FOREACH(const Argument& arg, *this) {
for(const Argument& arg: *this) {
Argument instArg = arg.expandTemplate(ts);
instArgList.push_back(instArg);
}
@ -50,7 +49,7 @@ ArgumentList ArgumentList::expandTemplate(
/* ************************************************************************* */
string Argument::matlabClass(const string& delim) const {
string result;
BOOST_FOREACH(const string& ns, type.namespaces())
for(const string& ns: type.namespaces())
result += ns + delim;
if (type.name() == "string" || type.name() == "unsigned char"
|| type.name() == "char")
@ -110,7 +109,7 @@ void Argument::proxy_check(FileWriter& proxyFile, const string& s) const {
string ArgumentList::types() const {
string str;
bool first = true;
BOOST_FOREACH(Argument arg, *this) {
for(Argument arg: *this) {
if (!first)
str += ",";
str += arg.type.name();
@ -124,8 +123,8 @@ string ArgumentList::signature() const {
string sig;
bool cap = false;
BOOST_FOREACH(Argument arg, *this) {
BOOST_FOREACH(char ch, arg.type.name())
for(Argument arg: *this) {
for(char ch: arg.type.name())
if (isupper(ch)) {
sig += ch;
//If there is a capital letter, we don't want to read it below
@ -144,7 +143,7 @@ string ArgumentList::signature() const {
string ArgumentList::names() const {
string str;
bool first = true;
BOOST_FOREACH(Argument arg, *this) {
for(Argument arg: *this) {
if (!first)
str += ",";
str += arg.name;
@ -155,7 +154,7 @@ string ArgumentList::names() const {
/* ************************************************************************* */
bool ArgumentList::allScalar() const {
BOOST_FOREACH(Argument arg, *this)
for(Argument arg: *this)
if (!arg.isScalar())
return false;
return true;
@ -164,7 +163,7 @@ bool ArgumentList::allScalar() const {
/* ************************************************************************* */
void ArgumentList::matlab_unwrap(FileWriter& file, int start) const {
int index = start;
BOOST_FOREACH(Argument arg, *this) {
for(Argument arg: *this) {
stringstream buf;
buf << "in[" << index << "]";
arg.matlab_unwrap(file, buf.str());
@ -176,7 +175,7 @@ void ArgumentList::matlab_unwrap(FileWriter& file, int start) const {
void ArgumentList::emit_prototype(FileWriter& file, const string& name) const {
file.oss << name << "(";
bool first = true;
BOOST_FOREACH(Argument arg, *this) {
for(Argument arg: *this) {
if (!first)
file.oss << ", ";
file.oss << arg.type.name() << " " << arg.name;

View File

@ -20,7 +20,6 @@
#include "utilities.h"
#include "Argument.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
@ -157,7 +156,7 @@ void Class::matlab_proxy(Str toolboxPath, Str wrapperName,
<< " function disp(obj), obj.display; end\n %DISP Calls print on the object\n";
// Methods
BOOST_FOREACH(const Methods::value_type& name_m, methods_) {
for(const Methods::value_type& name_m: methods_) {
const Method& m = name_m.second;
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName,
matlabUniqueName, wrapperName, typeAttributes, functionNames);
@ -172,7 +171,7 @@ void Class::matlab_proxy(Str toolboxPath, Str wrapperName,
proxyFile.oss << " methods(Static = true)\n";
// Static methods
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
for(const StaticMethods::value_type& name_m: static_methods) {
const StaticMethod& m = name_m.second;
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName,
matlabUniqueName, wrapperName, typeAttributes, functionNames);
@ -301,7 +300,7 @@ Class Class::expandTemplate(const TemplateSubstitution& ts) const {
vector<Class> Class::expandTemplate(Str templateArg,
const vector<Qualified>& instantiations) const {
vector<Class> result;
BOOST_FOREACH(const Qualified& instName, instantiations) {
for(const Qualified& instName: instantiations) {
Qualified expandedClass = (Qualified) (*this);
expandedClass.expand(instName.name());
const TemplateSubstitution ts(templateArg, instName, expandedClass);
@ -319,7 +318,7 @@ vector<Class> Class::expandTemplate(Str templateArg,
vector<Class> Class::expandTemplate(Str templateArg,
const vector<int>& integers) const {
vector<Class> result;
BOOST_FOREACH(int i, integers) {
for(int i: integers) {
Qualified expandedClass = (Qualified) (*this);
stringstream ss; ss << i;
string instName = ss.str();
@ -342,7 +341,7 @@ void Class::addMethod(bool verbose, bool is_const, Str methodName,
if (tmplate.valid()) {
// Create method to expand
// For all values of the template argument, create a new method
BOOST_FOREACH(const Qualified& instName, tmplate.argValues()) {
for(const Qualified& instName: tmplate.argValues()) {
const TemplateSubstitution ts(tmplate.argName(), instName, *this);
// substitute template in arguments
ArgumentList expandedArgs = argumentList.expandTemplate(ts);
@ -413,7 +412,7 @@ void Class::appendInheritedMethods(const Class& cls,
if (cls.parentClass) {
// Find parent
BOOST_FOREACH(const Class& parent, classes) {
for(const Class& parent: classes) {
// We found a parent class for our parent, TODO improve !
if (parent.name() == cls.parentClass->name()) {
methods_.insert(parent.methods_.begin(), parent.methods_.end());
@ -426,7 +425,7 @@ void Class::appendInheritedMethods(const Class& cls,
/* ************************************************************************* */
string Class::getTypedef() const {
string result;
BOOST_FOREACH(Str namesp, namespaces()) {
for(Str namesp: namespaces()) {
result += ("namespace " + namesp + " { ");
}
result += ("typedef " + typedefName + " " + name() + ";");
@ -446,12 +445,12 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
if (!methods_.empty())
proxyFile.oss << "%\n%-------Methods-------\n";
BOOST_FOREACH(const Methods::value_type& name_m, methods_)
for(const Methods::value_type& name_m: methods_)
name_m.second.comment_fragment(proxyFile);
if (!static_methods.empty())
proxyFile.oss << "%\n%-------Static Methods-------\n";
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods)
for(const StaticMethods::value_type& name_m: static_methods)
name_m.second.comment_fragment(proxyFile);
if (hasSerialization) {
@ -653,9 +652,9 @@ string Class::getSerializationExport() const {
void Class::python_wrapper(FileWriter& wrapperFile) const {
wrapperFile.oss << "class_<" << name() << ">(\"" << name() << "\")\n";
constructor.python_wrapper(wrapperFile, name());
BOOST_FOREACH(const StaticMethod& m, static_methods | boost::adaptors::map_values)
for(const StaticMethod& m: static_methods | boost::adaptors::map_values)
m.python_wrapper(wrapperFile, name());
BOOST_FOREACH(const Method& m, methods_ | boost::adaptors::map_values)
for(const Method& m: methods_ | boost::adaptors::map_values)
m.python_wrapper(wrapperFile, name());
wrapperFile.oss << ";\n\n";
}

View File

@ -39,7 +39,6 @@
namespace bl = boost::lambda;
#include <boost/foreach.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/optional.hpp>
@ -145,9 +144,9 @@ public:
friend std::ostream& operator<<(std::ostream& os, const Class& cls) {
os << "class " << cls.name() << "{\n";
os << cls.constructor << ";\n";
BOOST_FOREACH(const StaticMethod& m, cls.static_methods | boost::adaptors::map_values)
for(const StaticMethod& m: cls.static_methods | boost::adaptors::map_values)
os << m << ";\n";
BOOST_FOREACH(const Method& m, cls.methods_ | boost::adaptors::map_values)
for(const Method& m: cls.methods_ | boost::adaptors::map_values)
os << m << ";\n";
os << "};" << std::endl;
return os;

View File

@ -44,7 +44,7 @@ public:
void verifyReturnTypes(const std::vector<std::string>& validtypes,
const std::string& s) const {
BOOST_FOREACH(const ReturnValue& retval, returnVals_) {
for(const ReturnValue& retval: returnVals_) {
retval.type1.verify(validtypes, s);
if (retval.isPair)
retval.type2.verify(validtypes, s);
@ -55,7 +55,7 @@ public:
std::vector<ReturnValue> expandReturnValuesTemplate(
const TemplateSubstitution& ts) const {
std::vector<ReturnValue> result;
BOOST_FOREACH(const ReturnValue& retVal, returnVals_) {
for(const ReturnValue& retVal: returnVals_) {
ReturnValue instRetVal = retVal.expandTemplate(ts);
result.push_back(instRetVal);
}
@ -73,7 +73,7 @@ public:
// emit a list of comments, one for each overload
void usage_fragment(FileWriter& proxyFile, const std::string& name) const {
unsigned int argLCount = 0;
BOOST_FOREACH(ArgumentList argList, argLists_) {
for(ArgumentList argList: argLists_) {
argList.emit_prototype(proxyFile, name);
if (argLCount != nrOverloads() - 1)
proxyFile.oss << ", ";
@ -87,7 +87,7 @@ public:
// emit a list of comments, one for each overload
void comment_fragment(FileWriter& proxyFile, const std::string& name) const {
size_t i = 0;
BOOST_FOREACH(ArgumentList argList, argLists_) {
for(ArgumentList argList: argLists_) {
proxyFile.oss << "%";
argList.emit_prototype(proxyFile, name);
proxyFile.oss << " : returns " << returnVals_[i++].return_type(false)
@ -125,7 +125,7 @@ template<class F>
inline void verifyReturnTypes(const std::vector<std::string>& validTypes,
const std::map<std::string, F>& vt) {
typedef typename std::map<std::string, F>::value_type NamedMethod;
BOOST_FOREACH(const NamedMethod& namedMethod, vt)
for(const NamedMethod& namedMethod: vt)
namedMethod.second.verifyReturnTypes(validTypes);
}

View File

@ -8,7 +8,6 @@
#include "GlobalFunction.h"
#include "utilities.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace wrap {
@ -44,7 +43,7 @@ void GlobalFunction::matlab_proxy(const string& toolboxPath,
}
size_t lastcheck = grouped_functions.size();
BOOST_FOREACH(const GlobalFunctionMap::value_type& p, grouped_functions) {
for(const GlobalFunctionMap::value_type& p: grouped_functions) {
p.second.generateSingleFunction(toolboxPath, wrapperName, typeAttributes,
file, functionNames);
if (--lastcheck != 0)

View File

@ -22,7 +22,6 @@
#include "TypeAttributesTable.h"
#include "utilities.h"
#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
@ -58,7 +57,7 @@ static void handle_possible_template(vector<Class>& classes, const Class& cls,
vector<Class> classInstantiations =
(t.nrValues() > 0) ? cls.expandTemplate(arg, t.argValues()) :
cls.expandTemplate(arg, t.intList());
BOOST_FOREACH(const Class& c, classInstantiations)
for(const Class& c: classInstantiations)
classes.push_back(c);
}
}
@ -177,11 +176,11 @@ void Module::parseMarkup(const std::string& data) {
}
// Post-process classes for serialization markers
BOOST_FOREACH(Class& cls, classes)
for(Class& cls: classes)
cls.erase_serialization();
// Explicitly add methods to the classes from parents so it shows in documentation
BOOST_FOREACH(Class& cls, classes)
for(Class& cls: classes)
cls.appendInheritedMethods(cls, classes);
// Expand templates - This is done first so that template instantiations are
@ -199,7 +198,7 @@ void Module::parseMarkup(const std::string& data) {
verifyReturnTypes<GlobalFunction>(validTypes, global_functions);
hasSerialiable = false;
BOOST_FOREACH(const Class& cls, expandedClasses)
for(const Class& cls: expandedClasses)
cls.verifyAll(validTypes,hasSerialiable);
// Create type attributes table and check validity
@ -239,14 +238,14 @@ void Module::matlab_code(const string& toolboxPath) const {
// create typedef classes - we put this at the top of the wrap file so that
// collectors and method arguments can use these typedefs
BOOST_FOREACH(const Class& cls, expandedClasses)
for(const Class& cls: expandedClasses)
if(!cls.typedefName.empty())
wrapperFile.oss << cls.getTypedef() << "\n";
wrapperFile.oss << "\n";
// Generate boost.serialization export flags (needs typedefs from above)
if (hasSerialiable) {
BOOST_FOREACH(const Class& cls, expandedClasses)
for(const Class& cls: expandedClasses)
if(cls.isSerializable)
wrapperFile.oss << cls.getSerializationExport() << "\n";
wrapperFile.oss << "\n";
@ -261,11 +260,11 @@ void Module::matlab_code(const string& toolboxPath) const {
vector<string> functionNames; // Function names stored by index for switch
// create proxy class and wrapper code
BOOST_FOREACH(const Class& cls, expandedClasses)
for(const Class& cls: expandedClasses)
cls.matlab_proxy(toolboxPath, wrapperName, typeAttributes, wrapperFile, functionNames);
// create matlab files and wrapper code for global functions
BOOST_FOREACH(const GlobalFunctions::value_type& p, global_functions)
for(const GlobalFunctions::value_type& p: global_functions)
p.second.matlab_proxy(toolboxPath, wrapperName, typeAttributes, wrapperFile, functionNames);
// finish wrapper file
@ -321,7 +320,7 @@ vector<Class> Module::ExpandTypedefInstantiations(const vector<Class>& classes,
vector<Class> expandedClasses = classes;
BOOST_FOREACH(const TemplateInstantiationTypedef& inst, instantiations) {
for(const TemplateInstantiationTypedef& inst: instantiations) {
// Add the new class to the list
expandedClasses.push_back(inst.findAndExpand(classes));
}
@ -339,7 +338,7 @@ vector<Class> Module::ExpandTypedefInstantiations(const vector<Class>& classes,
/* ************************************************************************* */
vector<string> Module::GenerateValidTypes(const vector<Class>& classes, const vector<ForwardDeclaration> forwardDeclarations) {
vector<string> validTypes;
BOOST_FOREACH(const ForwardDeclaration& fwDec, forwardDeclarations) {
for(const ForwardDeclaration& fwDec: forwardDeclarations) {
validTypes.push_back(fwDec.name);
}
validTypes.push_back("void");
@ -353,7 +352,7 @@ vector<string> Module::GenerateValidTypes(const vector<Class>& classes, const ve
validTypes.push_back("Vector");
validTypes.push_back("Matrix");
//Create a list of parsed classes for dependency checking
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
validTypes.push_back(cls.qualifiedName("::"));
}
@ -363,7 +362,7 @@ vector<string> Module::GenerateValidTypes(const vector<Class>& classes, const ve
/* ************************************************************************* */
void Module::WriteCollectorsAndCleanupFcn(FileWriter& wrapperFile, const std::string& moduleName, const std::vector<Class>& classes) {
// Generate all collectors
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
const string matlabUniqueName = cls.qualifiedName(),
cppName = cls.qualifiedName("::");
wrapperFile.oss << "typedef std::set<boost::shared_ptr<" << cppName << ">*> "
@ -379,7 +378,7 @@ void Module::WriteCollectorsAndCleanupFcn(FileWriter& wrapperFile, const std::st
" mstream mout;\n" // Send stdout to MATLAB console
" std::streambuf *outbuf = std::cout.rdbuf(&mout);\n\n"
" bool anyDeleted = false;\n";
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
const string matlabUniqueName = cls.qualifiedName();
const string cppName = cls.qualifiedName("::");
const string collectorType = "Collector_" + matlabUniqueName;
@ -411,7 +410,7 @@ void Module::WriteRTTIRegistry(FileWriter& wrapperFile, const std::string& modul
" const mxArray *alreadyCreated = mexGetVariablePtr(\"global\", \"gtsam_" + moduleName + "_rttiRegistry_created\");\n"
" if(!alreadyCreated) {\n"
" std::map<std::string, std::string> types;\n";
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
if(cls.isVirtual)
wrapperFile.oss <<
" types.insert(std::make_pair(typeid(" << cls.qualifiedName("::") << ").name(), \"" << cls.qualifiedName(".") << "\"));\n";
@ -423,7 +422,7 @@ void Module::WriteRTTIRegistry(FileWriter& wrapperFile, const std::string& modul
" if(!registry)\n"
" registry = mxCreateStructMatrix(1, 1, 0, NULL);\n"
" typedef std::pair<std::string, std::string> StringPair;\n"
" BOOST_FOREACH(const StringPair& rtti_matlab, types) {\n"
" for(const StringPair& rtti_matlab: types) {\n"
" int fieldId = mxAddField(registry, rtti_matlab.first.c_str());\n"
" if(fieldId < 0)\n"
" mexErrMsgTxt(\"gtsam wrap: Error indexing RTTI types, inheritance will not work correctly\");\n"
@ -458,11 +457,11 @@ void Module::python_wrapper(const string& toolboxPath) const {
wrapperFile.oss << "{\n";
// write out classes
BOOST_FOREACH(const Class& cls, expandedClasses)
for(const Class& cls: expandedClasses)
cls.python_wrapper(wrapperFile);
// write out global functions
BOOST_FOREACH(const GlobalFunctions::value_type& p, global_functions)
for(const GlobalFunctions::value_type& p: global_functions)
p.second.python_wrapper(wrapperFile);
// finish wrapper file

View File

@ -49,7 +49,7 @@ public:
std::vector<ArgumentList> expandArgumentListsTemplate(
const TemplateSubstitution& ts) const {
std::vector<ArgumentList> result;
BOOST_FOREACH(const ArgumentList& argList, argLists_) {
for(const ArgumentList& argList: argLists_) {
ArgumentList instArgList = argList.expandTemplate(ts);
result.push_back(instArgList);
}
@ -63,8 +63,8 @@ public:
void verifyArguments(const std::vector<std::string>& validArgs,
const std::string s) const {
BOOST_FOREACH(const ArgumentList& argList, argLists_) {
BOOST_FOREACH(Argument arg, argList) {
for(const ArgumentList& argList: argLists_) {
for(Argument arg: argList) {
std::string fullType = arg.type.qualifiedName("::");
if (find(validArgs.begin(), validArgs.end(), fullType)
== validArgs.end())
@ -75,7 +75,7 @@ public:
friend std::ostream& operator<<(std::ostream& os,
const ArgumentOverloads& overloads) {
BOOST_FOREACH(const ArgumentList& argList, overloads.argLists_)
for(const ArgumentList& argList: overloads.argLists_)
os << argList << std::endl;
return os;
}
@ -106,7 +106,7 @@ static std::map<std::string, F> expandMethodTemplate(
const std::map<std::string, F>& methods, const TemplateSubstitution& ts) {
std::map<std::string, F> result;
typedef std::pair<const std::string, F> NamedMethod;
BOOST_FOREACH(NamedMethod namedMethod, methods) {
for(NamedMethod namedMethod: methods) {
F instMethod = namedMethod.second;
instMethod.expandTemplate(ts);
namedMethod.second = instMethod;
@ -119,7 +119,7 @@ template<class F>
inline void verifyArguments(const std::vector<std::string>& validArgs,
const std::map<std::string, F>& vt) {
typedef typename std::map<std::string, F>::value_type NamedMethod;
BOOST_FOREACH(const NamedMethod& namedMethod, vt)
for(const NamedMethod& namedMethod: vt)
namedMethod.second.verifyArguments(validArgs);
}

View File

@ -20,7 +20,6 @@
#include "utilities.h"
#include <iostream>
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
using namespace std;
@ -31,7 +30,7 @@ Class TemplateInstantiationTypedef::findAndExpand(
const vector<Class>& classes) const {
// Find matching class
boost::optional<Class const &> matchedClass;
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
if (cls.name() == class_.name() && cls.namespaces() == class_.namespaces()
&& cls.templateArgs.size() == typeList.size()) {
matchedClass.reset(cls);

View File

@ -20,7 +20,6 @@
#include "Class.h"
#include "utilities.h"
#include <boost/foreach.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
@ -45,7 +44,7 @@ const TypeAttributes& TypeAttributesTable::attributes(const string& key) const {
/* ************************************************************************* */
void TypeAttributesTable::addClasses(const vector<Class>& classes) {
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
if (!table_.insert(
make_pair(cls.qualifiedName("::"), TypeAttributes(cls.isVirtual))).second)
throw DuplicateDefinition("class " + cls.qualifiedName("::"));
@ -55,7 +54,7 @@ void TypeAttributesTable::addClasses(const vector<Class>& classes) {
/* ************************************************************************* */
void TypeAttributesTable::addForwardDeclarations(
const vector<ForwardDeclaration>& forwardDecls) {
BOOST_FOREACH(const ForwardDeclaration& fwDec, forwardDecls) {
for(const ForwardDeclaration& fwDec: forwardDecls) {
if (!table_.insert(make_pair(fwDec.name, TypeAttributes(fwDec.isVirtual))).second)
throw DuplicateDefinition("class " + fwDec.name);
}
@ -63,7 +62,7 @@ void TypeAttributesTable::addForwardDeclarations(
/* ************************************************************************* */
void TypeAttributesTable::checkValidity(const vector<Class>& classes) const {
BOOST_FOREACH(const Class& cls, classes) {
for(const Class& cls: classes) {
boost::optional<string> parent = cls.qualifiedParent();
if (parent) {

View File

@ -1,6 +1,5 @@
#include <wrap/matlab.h>
#include <map>
#include <boost/foreach.hpp>
#include <boost/serialization/export.hpp>
#include <boost/archive/text_iarchive.hpp>
@ -116,7 +115,7 @@ void _geometry_RTTIRegister() {
if(!registry)
registry = mxCreateStructMatrix(1, 1, 0, NULL);
typedef std::pair<std::string, std::string> StringPair;
BOOST_FOREACH(const StringPair& rtti_matlab, types) {
for(const StringPair& rtti_matlab: types) {
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
if(fieldId < 0)
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");

View File

@ -1,6 +1,5 @@
#include <wrap/matlab.h>
#include <map>
#include <boost/foreach.hpp>
#include <folder/path/to/Test.h>
@ -91,7 +90,7 @@ void _geometry_RTTIRegister() {
if(!registry)
registry = mxCreateStructMatrix(1, 1, 0, NULL);
typedef std::pair<std::string, std::string> StringPair;
BOOST_FOREACH(const StringPair& rtti_matlab, types) {
for(const StringPair& rtti_matlab: types) {
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
if(fieldId < 0)
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");

View File

@ -1,6 +1,5 @@
#include <wrap/matlab.h>
#include <map>
#include <boost/foreach.hpp>
#include <path/to/ns1.h>
#include <path/to/ns1/ClassB.h>
@ -81,7 +80,7 @@ void _testNamespaces_RTTIRegister() {
if(!registry)
registry = mxCreateStructMatrix(1, 1, 0, NULL);
typedef std::pair<std::string, std::string> StringPair;
BOOST_FOREACH(const StringPair& rtti_matlab, types) {
for(const StringPair& rtti_matlab: types) {
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
if(fieldId < 0)
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");

View File

@ -19,7 +19,6 @@
#include <iostream>
#include <cstdlib>
#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>
#include "utilities.h"
@ -71,9 +70,9 @@ bool assert_equal(const vector<string>& expected, const vector<string>& actual)
}
if(!match) {
cout << "expected: " << endl;
BOOST_FOREACH(const vector<string>::value_type& a, expected) { cout << "[" << a << "] "; }
for(const vector<string>::value_type& a: expected) { cout << "[" << a << "] "; }
cout << "\nactual: " << endl;
BOOST_FOREACH(const vector<string>::value_type& a, actual) { cout << "[" << a << "] "; }
for(const vector<string>::value_type& a: actual) { cout << "[" << a << "] "; }
cout << endl;
return false;
}
@ -132,7 +131,7 @@ void createNamespaceStructure(const std::vector<std::string>& namespaces,
const std::string& toolboxPath) {
using namespace boost::filesystem;
path curPath = toolboxPath;
BOOST_FOREACH(const string& subdir, namespaces) {
for(const string& subdir: namespaces) {
// curPath /= "+" + subdir; // original - resulted in valgrind error
curPath = curPath / string(string("+") + subdir);
if(!is_directory(curPath)) {