mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
784b900218
When we were previously removing allocators, we were only able to work with containers whose allocators appeared as their last template parameter. Now we can replace allocators in the middle of a parameter list. This fixes tests for folly::sorted_vector_set.
37 lines
862 B
TOML
37 lines
862 B
TOML
[info]
|
|
type_name = "std::vector"
|
|
stub_template_params = [1]
|
|
ctype = "SEQ_TYPE"
|
|
header = "vector"
|
|
|
|
# Old:
|
|
typeName = "std::vector<"
|
|
ns = ["namespace std"]
|
|
numTemplateParams = 1
|
|
allocatorIndex = 1
|
|
|
|
[codegen]
|
|
decl = """
|
|
template<typename T, typename Allocator>
|
|
void getSizeType(const %1%<T, Allocator> &container, size_t& returnArg);
|
|
"""
|
|
|
|
func = """
|
|
template<typename T, typename Allocator>
|
|
void getSizeType(const %1%<T, Allocator> &container, size_t& returnArg)
|
|
{
|
|
SAVE_SIZE(sizeof(%1%<T>));
|
|
|
|
SAVE_DATA((uintptr_t)&container);
|
|
SAVE_DATA((uintptr_t)container.capacity());
|
|
SAVE_DATA((uintptr_t)container.size());
|
|
|
|
SAVE_SIZE((container.capacity() - container.size()) * sizeof(T));
|
|
|
|
// The double ampersand is needed otherwise this loop doesn't work with vector<bool>
|
|
for (auto&& it: container) {
|
|
getSizeType(it, returnArg);
|
|
}
|
|
}
|
|
"""
|