Skip to content

Instantly share code, notes, and snippets.

@OXPHOS
Last active July 18, 2016 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OXPHOS/521fba4f635590f8e7782b634874dc66 to your computer and use it in GitHub Desktop.
Save OXPHOS/521fba4f635590f8e7782b634874dc66 to your computer and use it in GitHub Desktop.
template<class Archive>
void CSGObject::cereal_save(Archive& ar) const
{
int y = 0;
for (auto it = self->map.begin(); it != self->map.end(); ++it, ++y)
{
std::cerr << "num. " << y << std::endl;
ar(it->second);
}
}
[ RUN ] Cereal.Json_SGObject_save_load_pair
enum 1
enum 2
enum 4
enum 1
enum 2
enum 4
num. 0
[ERROR] In file /Users/zora/Github/shogun/src/shogun/lib/any.h line 279: Type error: undefined data type
unknown file: Failure
#ifdef HAVE_CXX11
typedef std::unordered_map<BaseTag, Any> ParametersMap;
#else
typedef std::map<BaseTag, Any> ParametersMap;
#endif
class CSGObject::Self
{
public:
void set(const BaseTag& tag, const Any& any)
{
map[tag] = any;
}
Any get(const BaseTag& tag) const
{
if(!has(tag))
return Any();
return map.at(tag);
}
bool has(const BaseTag& tag) const
{
return map.find(tag) != map.end();
}
ParametersMap map;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment