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

Convert into a constexpr unordered_map #50

Open
amallia opened this issue Jan 9, 2019 · 1 comment
Open

Convert into a constexpr unordered_map #50

amallia opened this issue Jan 9, 2019 · 1 comment
Assignees
Labels
maintenance Maintenance, technical debt priority:low

Comments

@amallia
Copy link
Member

amallia commented Jan 9, 2019

#define DS2I_INDEX_TYPES \
(ef)(single)(uniform)(opt)(block_optpfor)(block_varintg8iu)(block_streamvbyte)( \
block_maskedvbyte)(block_interpolative)(block_qmx)(block_varintgb)(block_simple8b)( \
block_simple16)(block_simdbp)(block_mixed)
#define DS2I_BLOCK_INDEX_TYPES \
(block_optpfor)(block_varintg8iu)(block_streamvbyte)(block_maskedvbyte)(block_interpolative)( \
block_qmx)(block_varintgb)(block_simple8b)(block_simple16)(block_simdbp)(block_mixed)

This can be converted into a constexpr map, s.t. the following can be implemented with a table lookup.

if (false) {
#define LOOP_BODY(R, DATA, T) \
} else if (type == BOOST_PP_STRINGIZE(T)) { \
selective_queries<BOOST_PP_CAT(T, _index)> \
(index_filename, type);
/**/
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, DS2I_INDEX_TYPES);
#undef LOOP_BODY
} else {
logger() << "ERROR: Unknown type " << type << std::endl;
}

@amallia amallia self-assigned this Jan 9, 2019
@amallia amallia added the enhancement New feature or request label Jan 9, 2019
@amallia
Copy link
Member Author

amallia commented Jan 9, 2019

We could use https://github.com/serge-sans-paille/frozen here.

@elshize elshize added priority:low maintenance Maintenance, technical debt and removed enhancement New feature or request labels Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance, technical debt priority:low
Projects
None yet
Development

No branches or pull requests

2 participants