Add parseIterator method to Json::Reader

Because this:

    reader.parseIterator(vec.begin(), vec.end(), root);

is way more intuitive than:

    reader.parse(&(*vec.begin()), &(*vec.end()), root);
I think there's a false economy there. The human engineering cost of adding
the definition when it's necessary becomes a point of brittleness. Nobody
thinks twice about including <string> or <vector>. We should assume the
relatively tiny templates we need here are cheap enough to compile every
time.

Writing out full definitions for templates will also help diagnose
and eliminate ODR risks.

One way to get a little of the best of both worlds is with C++11 extern
templates, if you know the major template parameters to expect, like
append<const char*> in this case.

On Saturday, November 15, 2014, Christopher Dunn <notifications@github.com>
wrote:

> In include/json/reader.h:
>
> > @@ -99,6 +99,12 @@ class JSON_API Reader {
> >    /// \see Json::operator>>(std::istream&, Json::Value&).
> >    bool parse(std::istream& is, Value& root, bool collectComments = true);
> >
> > +  /// \brief Parse from iterator
> > +  template<typename Iterator>
> > +  bool parseIterator(Iterator begin, Iterator end, Value& root, bool collectComments = true) {
> > +    return parse(&(*begin), &(*end), root, collectComments);
>
> Also, I'd rather have template code in a separate header when possible, to
> reduce compilation-time for those who do not need templates. But that's
> just a preference. Maybe compilers are getting faster?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/open-source-parsers/jsoncpp/pull/75/files#r20404843>.
>


-- 
ǝnɥɐuop ʎllıq