Skip to content

Conversation

@maloel
Copy link
Contributor

@maloel maloel commented Jul 25, 2024

Innocent-looking code like this (from PR #13185):

if( auto j = rsutils::json_config::load_from_file( filename ) )
    _j = std::move( j );

does an implicit bool conversion.

This is implemented in json_ref as exists() while the default json implementation uses an implicit templated conversion. The logic is different.

We decided to align the operator bool logic so they both behave the same: both check for existence rather than doing a conversion. It is preferable to never use implicit conversions!

@maloel maloel requested a review from OhadMeir July 25, 2024 06:08
@maloel maloel merged commit c1adf0c into realsenseai:development Jul 25, 2024
@maloel maloel deleted the json-bool branch July 25, 2024 08:10
maloel added a commit to maloel/librealsense that referenced this pull request Jul 29, 2024
maloel added a commit that referenced this pull request Jul 29, 2024
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

Successfully merging this pull request may close these issues.

2 participants