Menu

#5694 Dot_configuration maintenance

Fixed
Dan Eble
Enhancement
2020-01-29
2020-01-25
Dan Eble
No

1: iterate properly in reverse
The previous code would have malfunctioned for an empty container.

2: swap instead of copy

3: reduce repetition using a lambda function

4: use range-for loops

5: Dot_configuration "has a" instead of "is a" std::map

It is considered poor form to create subclasses of standard containers
because they lack virtual destructors. Inheriting privately from
std::map avoids potential problems by preventing Dot_configuration from
being treated as a std::map from the outside. (I didn't find any actual
problems in this case.)

Limiting the Dot_configuration interface to just the map methods that
are actually used makes it easier to understand how Dot_configuration is
used without searching the entire code.

https://codereview.appspot.com/577380046

Discussion

  • Anonymous

    Anonymous - 2020-01-26
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
    • Type: -->
     
  • Anonymous

    Anonymous - 2020-01-26

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2020-01-27
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2020-01-27

    Patch on countdown for Jan 29th

     
  • Anonymous

    Anonymous - 2020-01-29
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2020-01-29

    Patch counted down - please push

     
  • Dan Eble

    Dan Eble - 2020-01-29
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
    • Type: --> Enhancement
     
  • Dan Eble

    Dan Eble - 2020-01-29
    commit cd83bbc1eb44224ab3c0268d78a862e3d9987988
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Mon Nov 4 18:51:53 2019 -0500
    
        Issue 5694/5: Dot_configuration "has a" instead of "is a" std::map
    
        It is considered poor form to create subclasses of standard containers
        because they lack virtual destructors.  Inheriting privately from
        std::map avoids potential problems by preventing Dot_configuration from
        being treated as a std::map from the outside.  (I didn't find any actual
        problems in this case.)
    
        Limiting the Dot_configuration interface to just the map methods that
        are actually used makes it easier to understand how Dot_configuration is
        used without searching the entire code.
    
    commit 2c7fbb3196f28246a389c8e96d6aa5fdd02b3938
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Mon Nov 4 18:51:53 2019 -0500
    
        Issue 5694/4: Dot_configuration: use range-for loops
    
    commit d720cf21b540e58c81c82c04584def0b254ef21e
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Sat Jan 25 10:43:59 2020 -0500
    
        Issue 5694/3: Dot_configuration: reduce repetition using a lambda function
    
    commit 1c3de1ef82563239979642194329e74669e3c62a
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Mon Nov 4 18:51:53 2019 -0500
    
        Issue 5694/2: Dot_configuration: swap instead of copy
    
    commit 15d5a6cf2cc6eb8621a9f06874684464defb6bf8
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Sat Jan 25 10:42:37 2020 -0500
    
        Issue 5694/1: Dot_configuration: iterate properly in reverse
    
        The previous code would have malfunctioned for an empty container.