Augment DynamicConverter's is_container check
Summary: DynamicConverter uses some simple heuristics to determine if a class is a container. One of those tests was to check that the constructor 'template <class Iterator> [container-name](Iterator first, Iterator last)' was present. That test was performed by checking if the class could be constructed by two parameters of some dummy class. However, it is possible to restrict the template parameter such that it only accepts iterators, and not any arbitrary dummy class. This would be useful, for example, to solve overload ambiguity with constructors like 'vector(const T& val, size_type n)', where T and size_type are the same (see N3337 23.2.3 item 14). It also (I believe) produces more meaningful compiler errors when a non-iterator is supplied, since it errors at the function callsite instead of inside the constructor itself. The new FBVector implementation uses such a feature, and so checking for [container-name](dummy, dummy) will fail. Hence the dummy class has been upgraded to reverse_iterator<T*>, a valid iterator class which almost certainly does not have a specialized contructor in any class (and hence will not cause any visible change in class_is_container's value). Test Plan: Run DynamicConverterTest; it has tests for the correctness of class_is_container. Reviewed By: delong.j@fb.com FB internal diff: D620607
Showing
Please register or sign in to comment