Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add offsetof functionality #8

Merged
merged 4 commits into from
Sep 7, 2016
Merged

Conversation

Jopyth
Copy link
Contributor

@Jopyth Jopyth commented Aug 10, 2016

It does not belong into any of the existing folders, any (naming) suggestions on the category of this kind of functionality?

@sbusch42
Copy link
Member

What about 'memory'? Could get other members such as make_unique etc. (if needed)

@scheibel
Copy link
Member

scheibel commented Aug 10, 2016

I like the idea of memory although I wonder where to discriminate between functionality like make_unique and contains (e.g., on strings or containers).
Basically, I wish for another module where STL extensions can be located. make_unique would be such an STL extension, contains would also be. However, offsetof is more or less a language or compiler extension, not relying on the STL at all.

@scheibel
Copy link
Member

I also want to add the rationale for this functionality:

There is an inofficial offsetof language extension that is mainly implemented as compiler extension but it is rather limited in usage. Lately, some compilers even dropped support of this functionality.
However, I think we understand the limitations of the implementation and won't use it in problematic cases.

@scheibel
Copy link
Member

This PR is part of #6.


#include <cstddef>

namespace cppassist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ANother empty line here, please.

@sbusch42 sbusch42 merged commit 4182364 into cginternals:master Sep 7, 2016
@sbusch42 sbusch42 removed the Base label Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants