GitHub PullRequestReviewCommentEvent at 2014-04-26 23:38:09
Repository: spirit
Actor: K-ballo
Payload: {"comment":{"url":"https://api.github.com/repos/boostorg/spirit/pulls/comments/12026897","id":12026897,"diff_hunk":"@@ -0,0 +1,241 @@\n+/*//////////////////////////////////////////////////////////////////////////////\n+    Copyright (c) 2014 Jamboree\n+\n+    Distributed under the Boost Software License, Version 1.0. (See accompanying\n+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n+//////////////////////////////////////////////////////////////////////////////*/\n+#ifndef BOOST_SPIRIT_X3_DIRECTIVE_HPP_INCLUDED\n+#define BOOST_SPIRIT_X3_DIRECTIVE_HPP_INCLUDED\n+\n+#if defined(_MSC_VER)\n+#pragma once\n+#endif\n+\n+#include <tuple>\n+#include <boost/spirit/home/x3/core/parser.hpp>\n+#include <boost/spirit/home/x3/core/detail/eval.hpp>\n+#include <boost/spirit/home/x3/core/detail/transform_params.hpp>\n+#include <boost/spirit/home/x3/support/utility/integer_sequence.hpp>\n+#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>\n+#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>\n+#include <boost/spirit/home/x3/support/traits/handles_container.hpp>\n+\n+\n+namespace boost { namespace spirit { namespace x3 { namespace detail\n+{\n+    template <typename Directive, typename = void>\n+    struct caller_is_pass_through_unary\n+      : mpl::bool_<Directive::is_pass_through_unary> {};\n+      \n+    template <typename Directive>\n+    struct caller_is_pass_through_unary<Directive,\n+        typename disable_if_substitution_failure<\n+            mpl::bool_<Directive::caller_is_pass_through_unary>>::type>\n+      : mpl::bool_<Directive::caller_is_pass_through_unary> {};\n+}}}}\n+\n+namespace boost { namespace spirit { namespace x3\n+{\n+    template <typename Directive, typename Subject>\n+    struct directive_parser : unary_parser<Subject, directive_parser<Directive, Subject>>\n+    {\n+        typedef unary_parser<Subject, directive_parser<Directive, Subject>> base_type;\n+        static bool const is_pass_through_unary = Directive::is_pass_through_unary;\n+        static bool const handles_container = Subject::handles_container;\n+\n+        directive_parser(Directive const& directive, Subject const& subject)\n+          : base_type(subject), directive(directive) {}\n+          \n+        template <typename Iterator, typename Context, typename Attribute>\n+        bool parse(Iterator& first, Iterator const& last\n+          , Context const& context, Attribute& attr) const\n+        {\n+            return directive.parse(this->subject, first, last, context, attr);\n+        }\n+        \n+        Directive directive;\n+    };\n+    \n+    template <typename Directive, typename... Ts>\n+    struct directive_caller\n+    {\n+        typedef detail::transform_params<Directive, void, Ts...> transform;\n+        static bool const is_pass_through_unary =\n+            detail::caller_is_pass_through_unary<Directive>::value;\n+        \n+        template <typename... As>\n+        directive_caller(Directive const& directive, As&&... as)\n+          : directive(directive), params(std::forward<As>(as)...) {}\n+\n+        template <typename Subject>\n+        directive_parser<directive_caller, typename extension::as_parser<Subject>::value_type>\n+        operator[](Subject const& subject) const\n+        {\n+            return {*this, subject};\n+        }\n+        \n+        template <typename Subject, typename Iterator, typename Context, typename Attribute>\n+        bool parse(Subject const& subject, Iterator& first, Iterator const& last\n+          , Context const& context, Attribute& attr) const\n+        {\n+            typename transform::is_transformed tag;\n+            make_index_sequence<sizeof...(Ts)> indices;\n+            return parse_impl(tag, indices, subject, first, last, context, attr);\n+        }\n+        \n+        // transformed\n+        template <std::size_t... Ns, typename Subject\n+            , typename Iterator, typename Context, typename Attribute>\n+        bool parse_impl(mpl::true_, index_sequence<Ns...>\n+          , Subject const& subject, Iterator& first, Iterator const& last\n+          , Context const& context, Attribute& attr) const\n+        {\n+            return directive.parse(\n+                subject, first, last, context, attr, params.data);\n+        }\n+        \n+        // no transform_params\n+        template <std::size_t... Ns, typename Subject\n+            , typename Iterator, typename Context, typename Attribute>\n+        bool parse_impl(mpl::false_, index_sequence<Ns...>\n+          , Subject const& subject, Iterator& first, Iterator const& last\n+          , Context const& context, Attribute& attr) const\n+        {\n+            return invoke_parse(subject, first, last, context, attr,\n+                detail::eval<Ts const&>(std::get<Ns>(params), context)...);\n+        }\n+        \n+        template <typename Subject, typename Iterator, typename Context\n+            , typename Attribute, typename... As>\n+        typename detail::transform_params<Directive, void, As...>::yes\n+        invoke_parse(Subject const& subject, Iterator& first, Iterator const& last\n+          , Context const& context, Attribute& attr, As&&... as) const","path":"include/boost/spirit/home/x3/core/directive.hpp","position":112,"original_position":112,"commit_id":"7f7dbe90368a18d977e2c8aea313b0f1e57e016b","original_commit_id":"7f7dbe90368a18d977e2c8aea313b0f1e57e016b","user":{"login":"K-ballo","id":1700391,"avatar_url":"https://avatars.githubusercontent.com/u/1700391?","gravatar_id":"7e14cf6e5335ed666725ce5321fca619","url":"https://api.github.com/users/K-ballo","html_url":"https://github.com/K-ballo","followers_url":"https://api.github.com/users/K-ballo/followers","following_url":"https://api.github.com/users/K-ballo/following{/other_user}","gists_url":"https://api.github.com/users/K-ballo/gists{/gist_id}","starred_url":"https://api.github.com/users/K-ballo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/K-ballo/subscriptions","organizations_url":"https://api.github.com/users/K-ballo/orgs","repos_url":"https://api.github.com/users/K-ballo/repos","events_url":"https://api.github.com/users/K-ballo/events{/privacy}","received_events_url":"https://api.github.com/users/K-ballo/received_events","type":"User","site_admin":false},"body":"`transform_params<...>::yes` doesn't say to me that this overload will be disabled. Our idiomatic use is the `enable_if` one.","created_at":"2014-04-26T23:38:09Z","updated_at":"2014-04-26T23:38:09Z","html_url":"https://github.com/boostorg/spirit/pull/13#discussion_r12026897","pull_request_url":"https://api.github.com/repos/boostorg/spirit/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/boostorg/spirit/pulls/comments/12026897"},"html":{"href":"https://github.com/boostorg/spirit/pull/13#discussion_r12026897"},"pull_request":{"href":"https://api.github.com/repos/boostorg/spirit/pulls/13"}}}}