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

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

Open
TheWhiteBug opened this issue Jun 10, 2024 · 0 comments
Open

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

TheWhiteBug opened this issue Jun 10, 2024 · 0 comments

Comments

@TheWhiteBug
Copy link

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;
}
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