style: enforce non-member begin/end

1. Use value_type and size_type wherever appropriate in interface;
2. Use trailing return type to write less full qualified names.