mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-14 14:26:55 +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.
38 lines
1012 B
TOML
38 lines
1012 B
TOML
[info]
|
|
type_name = "std::basic_string"
|
|
stub_template_params = [2]
|
|
ctype = "STRING_TYPE"
|
|
header = "string"
|
|
|
|
# Old:
|
|
typeName = "std::basic_string<"
|
|
ns = ["namespace std"]
|
|
numTemplateParams = 1
|
|
replaceTemplateParamIndex = []
|
|
|
|
[codegen]
|
|
decl = """
|
|
template<typename T, typename Traits, typename Allocator>
|
|
void getSizeType(const %1%<T, Traits, Allocator> &container, size_t& returnArg);
|
|
"""
|
|
|
|
func = """
|
|
template<typename T, typename Traits, typename Allocator>
|
|
void getSizeType(const %1%<T, Traits, Allocator> &container, size_t& returnArg)
|
|
{
|
|
SAVE_SIZE(sizeof(%1%<T>));
|
|
|
|
SAVE_DATA((uintptr_t)container.capacity());
|
|
SAVE_DATA((uintptr_t)container.size());
|
|
|
|
// Test for small string optimisation - whether the underlying string is
|
|
// contained within the string object.
|
|
SAVE_SIZE(
|
|
((uintptr_t)container.data() < (uintptr_t)(&container + sizeof(%1%<T>)))
|
|
&&
|
|
((uintptr_t)container.data() >= (uintptr_t)&container)
|
|
? 0 : (container.capacity() * sizeof(T))
|
|
);
|
|
}
|
|
"""
|