mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-12 21:56:54 +00:00
sorted_vec_set: finish changing to a container adapter
This commit is contained in:
parent
b1c43c2b42
commit
3a236aa4f2
@ -607,6 +607,7 @@ void TreeBuilder::processContainer(const Variable &variable, Node &node) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SORTED_VEC_SET_TYPE:
|
||||
case CONTAINER_ADAPTER_TYPE: {
|
||||
node.pointer = next();
|
||||
|
||||
@ -673,7 +674,6 @@ void TreeBuilder::processContainer(const Variable &variable, Node &node) {
|
||||
break;
|
||||
case SEQ_TYPE:
|
||||
case MICROLIST_TYPE:
|
||||
case SORTED_VEC_SET_TYPE:
|
||||
case FEED_QUICK_HASH_SET:
|
||||
case FEED_QUICK_HASH_MAP:
|
||||
case FB_HASH_MAP_TYPE:
|
||||
|
@ -18,6 +18,7 @@ set(INTEGRATION_TEST_CONFIGS
|
||||
primitives.toml
|
||||
references.toml
|
||||
simple_struct.toml
|
||||
sorted_vector_set.toml
|
||||
std_array.toml
|
||||
std_conditional.toml
|
||||
std_deque_del_allocator.toml
|
||||
|
47
test/integration/sorted_vector_set.toml
Normal file
47
test/integration/sorted_vector_set.toml
Normal file
@ -0,0 +1,47 @@
|
||||
includes = ["folly/sorted_vector_types.h"]
|
||||
definitions = '''
|
||||
using folly::sorted_vector_set;
|
||||
'''
|
||||
|
||||
[cases]
|
||||
[cases.no_ints]
|
||||
param_types = ["const sorted_vector_set<int>&"]
|
||||
setup = "return {};"
|
||||
expect_json = '''[{
|
||||
"staticSize":24,
|
||||
"dynamicSize":0,
|
||||
"length":0,
|
||||
"capacity":0,
|
||||
"elementStaticSize":4,
|
||||
"members":[{
|
||||
"staticSize": 24,
|
||||
"dynamicSize": 0,
|
||||
"length": 0,
|
||||
"capacity": 0,
|
||||
"elementStaticSize": 4
|
||||
}]}]'''
|
||||
|
||||
[cases.some_ints]
|
||||
param_types = ["const sorted_vector_set<int>&"]
|
||||
setup = '''
|
||||
sorted_vector_set<int> is;
|
||||
is.insert(1);
|
||||
is.insert(3);
|
||||
is.insert(2);
|
||||
is.insert(3);
|
||||
return is;
|
||||
'''
|
||||
expect_json = '''[{
|
||||
"staticSize": 24,
|
||||
"dynamicSize": 16,
|
||||
"length":3,
|
||||
"capacity":4,
|
||||
"elementStaticSize":4,
|
||||
"members": [{
|
||||
"staticSize": 24,
|
||||
"dynamicSize": 16,
|
||||
"length": 3,
|
||||
"capacity": 4,
|
||||
"elementStaticSize": 4
|
||||
}]}]
|
||||
'''
|
@ -14,19 +14,14 @@ void getSizeType(const %1%<T,Compare, Allocator, GrowthPolicy, Container> &conta
|
||||
|
||||
func = """
|
||||
template <class T, class Compare, class Allocator, class GrowthPolicy, class Container>
|
||||
void getSizeType(const %1%<T,Compare, Allocator, GrowthPolicy, Container> &container, size_t& returnArg)
|
||||
void getSizeType(const %1%<T,Compare, Allocator, GrowthPolicy, Container> &containerAdapter, size_t& returnArg)
|
||||
{
|
||||
SAVE_SIZE(sizeof(%1%<T,Compare, Allocator, GrowthPolicy, Container>));
|
||||
SAVE_DATA((uintptr_t)&containerAdapter);
|
||||
|
||||
SAVE_DATA((uintptr_t)&container);
|
||||
SAVE_DATA((uintptr_t)container.capacity());
|
||||
SAVE_DATA((uintptr_t)container.size());
|
||||
// Underlying container is grabbed by recursion, store only the exclusive size.
|
||||
SAVE_SIZE(sizeof(%1%<T,Compare, Allocator, GrowthPolicy, Container>) - sizeof(Container));
|
||||
|
||||
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);
|
||||
}
|
||||
const Container &container = containerAdapter.get_container();
|
||||
getSizeType(container, returnArg);
|
||||
}
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user