Browse Source

Gmt module: Make Base2Something slightly more generic.

ObjPtr
Michael Uleysky 9 years ago
parent
commit
07752e21c9
  1. 5
      modules/gmt/modgmt_func.cpp

5
modules/gmt/modgmt_func.cpp

@ -22,10 +22,11 @@ class Base2Something: public OBTypeM<Func,O...>
Base2Something(const ObjectBase* arg):OBTypeM<Func,O...>(arg) {};
Base2Something(const ObjectList* input, const std::string& name):OBTypeM<Func,O...>(input->Get(name)){};
Base2Something(const ObjectList* input, const ObjectList::ListValues::size_type i):OBTypeM<Func,O...>((i<input->Size())?input->At(i):0){}; // Check index, because At is not safe
auto operator ()(bool* b) const -> decltype(this->OBTypeM<Func,O...>::template operator()<bool*>(b))
template<class... Args>
auto operator ()(bool* b, Args... args) const -> decltype(this->OBTypeM<Func,O...>::template operator()<bool*, Args...>(b, args...))
{
if(!OBTypeM<Func,O...>::operator bool()) *b=false;
return OBTypeM<Func,O...>::operator ()(b);
return OBTypeM<Func,O...>::operator ()(b,args...);
}
};

Loading…
Cancel
Save