typo in tutorial, add all alternatives to example

This commit is contained in:
Alec Jacobson
2015-12-17 12:00:17 -05:00
parent 423dfe04bf
commit 136bbd895e
2 changed files with 66 additions and 42 deletions
+15 -12
View File
@@ -2193,19 +2193,22 @@ void Serializable::PostDeserialization();
Alternatively, if you want a non-intrusive way of serializing your state you can overload the following functions:
```cpp
namespace igl { namespace serialization {
void serialize(const State& obj,std::vector<char>& buffer){
::igl::serialize(obj.V,std::string("V"),buffer);
::igl::serialize(obj.F,std::string("F"),buffer);
::igl::serialize(obj.ids,std::string("ids"),buffer);
namespace igl
{
namespace serialization
{
template <> inline void serialize(const State& obj,std::vector<char>& buffer){
::igl::serialize(obj.V,std::string("V"),buffer);
::igl::serialize(obj.F,std::string("F"),buffer);
::igl::serialize(obj.ids,std::string("ids"),buffer);
}
template <> inline void deserialize(State& obj,const std::vector<char>& buffer){
::igl::deserialize(obj.V,std::string("V"),buffer);
::igl::deserialize(obj.F,std::string("F"),buffer);
::igl::deserialize(obj.ids,std::string("ids"),buffer);
}
}
}
void deserialize(State& obj,const std::vector<char>& buffer){
::igl::deserialize(obj.V,std::string("V"),buffer);
::igl::deserialize(obj.F,std::string("F"),buffer);
::igl::deserialize(obj.ids,std::string("ids"),buffer);
}
}}
```
Equivalently, you can use the following macros: