-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[struct_pack][feat] support user-define global config (#741)
- Loading branch information
1 parent
a2709a0
commit a679faf
Showing
6 changed files
with
114 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "ylt/struct_pack.hpp" | ||
#include "ylt/struct_pack/reflection.hpp" | ||
// set global default struct pack config | ||
namespace struct_pack { | ||
constexpr sp_config set_default(sp_config*) { | ||
return sp_config::DISABLE_ALL_META_INFO; | ||
} | ||
} // namespace struct_pack | ||
struct rect { | ||
int a, b, c, d; | ||
}; | ||
struct rect2 { | ||
int a, b, c, d; | ||
}; | ||
constexpr struct_pack::sp_config set_sp_config(rect2*) { | ||
return struct_pack::sp_config::DISABLE_TYPE_INFO; | ||
} | ||
static_assert(struct_pack::get_needed_size(rect{}).size() == 16); | ||
static_assert(struct_pack::get_needed_size(rect2{}).size() == 20); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters