« Type ListsDesired Alchemy Syntax »

3 comments

  1. § Paul Watt®   said on :

    Thanks for taking the time to add comments and start a discussion.

    I don’t think I was ever counting on any specific internal representation from the std:tuple. I was more interested the ability to access both the type info and the data with one data type.

    There are two concepts to manage with Alchemy:

    1. The working object the user manipulates to access the data.
    2. The actual packed message format defined for the network or serialization protocol.

    The Tuple represents item 1. Where the fields are represented internally are not necessarily important to me, only that they use the fixed index, I can access the data, and the type information is correct so I can calculate the total size of the structure defined for item 2.

    This is a concept I was aware of, but didn’t pay too much attention to until I reached the later stages of development when I started to add support for arrays and vectors.

  2. § Daniel said on :

    I wrote a function that actually calculates OffsetOf for a std::tuple.

    See: http://ideone.com/82WemP

    This is kinda ugly because it derefenrences a NULL-pointer and shouldn’t be used in production code.. but it shows that (at least on gcc/linux, same for clang btw) the offset of the 0-th element (as obtained by std::get<0>(tuple) ) is not 0. And while it seems like the value is at the beginning of one std::tuple_element (offset 0 within it), I wouldn’t take that for granted in general, either.

  3. § Daniel said on :
    4 stars

    OffsetOf() is kinda interesting for an idea I’ve been having.. but it seems to assume that there is no padding within a tuple (the offset is just the sum of sizeof() of the predecessing elements).

    Is that actually guaranteed? I didn’t read the standard, but at least cppreference.com, cplusplus.com and MSDN don’t mention any requirements on the memory layout.

    http://mitchnull.blogspot.de/2012/06/c11-tuple-implementation-details-part-1.html says that the tuple elements may even be in the wrong order in memory…

    (for soome reason newlines in the text don’t seem to work, neither br-html-tags, at least in the preview?)

    Edit - I changed the settings to allow basic HTML tags through, use a <p> grouping to get newlines now.


Form is loading...

Contact / Help. ©2017 by Paul Watt; Charon adapted from work by daroz. blog soft / cheap web hosting / adsense.
Design & icons by N.Design Studio. Skin by Tender Feelings / Skin Faktory.