]> git.lyx.org Git - lyx.git/commit
Streamline use of map<col-type, bool>
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 13 Sep 2024 15:10:58 +0000 (17:10 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 26 Sep 2024 13:31:28 +0000 (15:31 +0200)
commit9fc19badaba8f891b4e9beb0f81f086e568b7ad3
treeb94f77962796a0976597f2244602f5a76a0428d7
parentfe19855116eac791ca676729e5cebba41d8c7c50
Streamline use of map<col-type, bool>

Typically, to check whether an element is present and set to true, instead of
  foo.find(c) != foo.end() && foo.find(c)->second
one uses
  foo[c]

The map<> code creates elements automatically when they do not exist
and zero-initializes them.

This avoids puzzlement of Coverity scan when seeing that find() result
is dereferenced without checking that it is not equal to end().
Moreover, this makes the code much much clearer. I still do not
understand it, though ;)
src/insets/InsetTabular.cpp