From 63d9db8438ed6b32c4a85d487c07ea31bda666e4 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 11 Sep 2014 00:47:56 +0200 Subject: Expanded formatter embellishment templates * XHTML elements "h2" and "h3" are replaced with "h3" and "h4" respectively ** modified all existing contents accordingly ** this was done to avoid the gap between the primary heading and subheadings in the markdown depiction of the contents * fleshed out the InputXSLT project page with further information --- ...ng_binary_structures_as_tuples_using_template_metaprogramming.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'articles/2013-11-03_mapping_binary_structures_as_tuples_using_template_metaprogramming.md') diff --git a/articles/2013-11-03_mapping_binary_structures_as_tuples_using_template_metaprogramming.md b/articles/2013-11-03_mapping_binary_structures_as_tuples_using_template_metaprogramming.md index a3af421..4d1aaa2 100644 --- a/articles/2013-11-03_mapping_binary_structures_as_tuples_using_template_metaprogramming.md +++ b/articles/2013-11-03_mapping_binary_structures_as_tuples_using_template_metaprogramming.md @@ -12,7 +12,7 @@ For the purpose of this article I am going to limit myself to flat structures wi write mappings like [EdgeId](https://github.com/KnairdA/GraphStorage/blob/master/src/storage/id/edge_id.cc) in a more compact and efficient way. This also includes support for handling differences in endianness and In-place modification of the structure fields. -### Mapping buffers as tuples +## Mapping buffers as tuples To be able to easily work with structure definitions using template metaprogramming I am relying on the standard libraries [_std::tuple_](http://en.cppreference.com/w/cpp/utility/tuple) template. @@ -123,7 +123,7 @@ std::cout << mapping.get<1>() << std::endl; ~~~ {: .language-cpp} -### Endianness +## Endianness As you may remember this does not take endianness into account as I defined as a requirement in the beginning. I first thought about including support for different endianness types into the _BinaryMapping_ template class which worked, but led to problems as soon as I mixed calls to _get_ and _set_. The resulting problems could of course have been fixed but this would probably @@ -212,7 +212,7 @@ It should be evident that the way both the _serialize_ and _deserialize_ templat is that no actual _std::tuple_ instantiation instance is touched and instead of setting pointers to the buffer we are only reordering the bytes of each section of the buffer corresponding to a tuple element. This results in a complete In-place conversion between different byte orderings using the methods provided by a _ByteSorter_ template such as _BigEndianSorter_. -### Conclusion +## Conclusion At last I am now able to do everything I planned in the beginning in a very compact way using the _Serializer_, _TupleReader_ and _BinaryMapping_ templates. In practice this now looks like this: -- cgit v1.2.3