> On June 28, 2016, 6:14 a.m., Vinod Kone wrote: > > src/master/http.cpp, line 1358 > > <https://reviews.apache.org/r/49137/diff/5/?file=1431412#file1431412line1358> > > > > don't use `auto` here because the type is not clear from this > > expression. > > zhou xing wrote: > If I reaplace auto with hashmap<ExecutorID, ExecutorInfo>, I got the > following compile error: > > ''' > ../../src/master/http.cpp:1274:16: error: too many arguments provided to > function-like macro invocation > framework.executors) { > ^ > ../../3rdparty/stout/include/stout/foreach.hpp:51:9: note: macro > 'foreachpair' > defined here > #define foreachpair(KEY, VALUE, ELEMS) > ''' > > I checked the code of foreachpair, seems it does not accept more than 1 > template params? > > zhou xing wrote: > another solution I can see is to use the following code to go through all > the executors: > > ``` > const hashset<SlaveID>& slaveIds = framework.executors.keys(); > foreach (const SlaveID& slaveId, slaveIds) { > const hashmap<ExecutorID, ExecutorInfo>& executorsMap = > framework.executors.get(slaveId).get(); > > foreachvalue (const ExecutorInfo& info, executorsMap) { > // Skip unauthorized executors. > if (!approveViewExecutorInfo(executorsApprover, > info, > framework.info)) { > continue; > } > > mesos::master::Response::GetFrameworks::Executor executor; > executor.mutable_info()->CopyFrom(executor); > executor.mutable_agent_id()->set_value(slaveId.value()); > > _framework.mutable_executors()->Add()->CopyFrom(executor); > } > } > ``` > I prefer to keep 'auto', as it is not that complex. What do you think? > > haosdent huang wrote: > Looks like the comma in `const hashmap<ExecutorID, ExecutorInfo>&` make > compiler confuse.
Refer to http://stackoverflow.com/questions/5414619/boost-c-macro-argument-count-error , I suggest to use `auto` here. - haosdent ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/49137/#review139729 ----------------------------------------------------------- On June 28, 2016, 8:11 a.m., zhou xing wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/49137/ > ----------------------------------------------------------- > > (Updated June 28, 2016, 8:11 a.m.) > > > Review request for mesos, Anand Mazumdar, haosdent huang, and Vinod Kone. > > > Bugs: mesos-5492 > https://issues.apache.org/jira/browse/mesos-5492 > > > Repository: mesos > > > Description > ------- > > Implemented getFrameworks method in http.cpp. > > > Diffs > ----- > > src/master/http.cpp d583bbeb186974135999eaddbab96e69635dcc7c > src/master/master.hpp ba271e7a175529c59abd8bb92536eb5bf0136a40 > src/tests/api_tests.cpp 7b5c761751e4b28e3966ac8180fb19ce00fc8f30 > > Diff: https://reviews.apache.org/r/49137/diff/ > > > Testing > ------- > > make > make check > > > Thanks, > > zhou xing > >
