tree: introduce range adaptor for TREE_VEC
This patch implements a simple tree wrapper, named tree_vec_range, which
lets us idiomatically loop over all the elements of a TREE_VEC using a
C++11 range-based for loop:
// v is a TREE_VEC
for (tree e : tree_vec_range (v))
...
This is similar to the existing tree-based range adaptors ovl_range and
lkp_range added to the C++ FE in
r12-340-g3307b9a07a3c51.
This patch also converts some existing loops over TREE_VEC within the
C++ FE to use tree_vec_range / range-for.
gcc/cp/ChangeLog:
* constraint.cc (tsubst_parameter_mapping): Convert loop over
TREE_VEC into a range-based for loop using tree_vec_range.
* pt.cc (iterative_hash_template_arg): Likewise.
(template_parms_level_to_args): Likewise.
(deducible_template_args): Likewise.
(check_undeduced_parms): Likewise.
(dependent_type_p_r): Likewise.
(value_dependent_expression_p) <case NONTYPE_ARGUMENT_PACK>:
Likewise.
(dependent_template_arg_p): Likewise.
* tree.cc (cp_walk_subtrees) <case NONTYPE_ARGUMENT_PACK>:
Likewise.
gcc/ChangeLog:
* tree.h (TREE_VEC_BEGIN): Define.
(TREE_VEC_END): Correct 'length' member access.
(class tree_vec_range): Define.