Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor member initializer issue #300

Closed
jonesmz opened this issue Jun 27, 2019 · 0 comments
Closed

Constructor member initializer issue #300

jonesmz opened this issue Jun 27, 2019 · 0 comments

Comments

@jonesmz
Copy link
Contributor

jonesmz commented Jun 27, 2019

    connack_message(
        bool session_present,
        std::uint8_t reason_code,
        properties props
    )
        : fixed_header_(make_fixed_header(control_packet_type::connack, 0b0000)),
          remaining_length_(
              1 + // connect acknowledge flags
              1   // reason code
          ),
          connect_acknowledge_flags_(session_present ? 1 : 0),
          reason_code_(reason_code),
          property_length_(
              std::accumulate(
                  props.begin(),
                  props.end(),
                  0U,
                  [](std::size_t total, property_variant const& pv) {
                      return total + v5::size(pv);
                  }
              )
          ),
          props_(std::move(props)),
          num_of_const_buffer_sequence_(
              1 +                   // fixed header
              1 +                   // remaining length
              1 +                   // connect acknowledge flags
              1 +                   // reason code
              1 +                   // property length
              std::accumulate(
                  props.begin(),
                  props.end(),
                  0U,
                  [](std::size_t total, property_variant const& pv) {
                      return total + v5::num_of_const_buffer_sequence(pv);
                  }
              )
          )

Note the use of props.begin() and props.end() after props_(std::move(props))

redboltz added a commit that referenced this issue Jun 29, 2019
Removed moved `props` accessing code.
redboltz added a commit that referenced this issue Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant