Skip to content

"const correctness" : parse_message() should be const #32

@TheWhiteBug

Description

@TheWhiteBug

I try to follow "const correctness" as much as possible. In this case, I need to declare my DbcParser member as "mutable" to circumvent the issue while in reality the method implementation is actually const:

Message::ParseSignalsStatus DbcParser::parse_message(const uint32_t message_id, const std::vector<uint8_t>& data, std::vector<double>& out_values) {
	for (const auto& message : messages) {
		if (message.id() == message_id) {
			return message.parse_signals(data, out_values);
		}
	}
	return Message::ParseSignalsStatus::ErrorUnknownID;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions