#234 Indentation Issues

closed-fixed
Jim Pattee
None
7
2015-01-03
2013-08-25
Matt
No

Thanks for astyle. Here are some indentation issues I found.

The command line used was:

astyle --mode=c --style=allman --indent-switches --indent-preprocessor --min-conditional-indent=0 --max-instatement-indent=120 --pad-oper --pad-paren --align-pointer=middle --align-reference=middle --add-brackets --formatted --recursive "lib/.cc" "lib/.h"

Issue 1.

namespace std
{
..../// std::hash specialization for ptr.
....template < typename T >
....struct hash<matt::ptr<T> > :
....public __hash_base<size_t, matt::ptr<T=""> >
....{
........size_t operator() ( const matt::ptr<T> & o ) const noexcept
........{
............using ptr_T = matt::ptr<T>;
............return hash<typename ptr_T::pointer_type=""> () ( o.get () );
........}
....};
} // namespace std

Issue 2.

namespace matt
{
template < typename T >
class ptr
{
public:
....template< typename = require_T<not_T<std::is_array<T>>>>
....explicit ptr ( pointer_type p ) noexcept :
........m_p ( p )
....{
....}
}
}

Issue 3.

When using ':' characters for base class definitions or initialisers, astyle definitely doesn't seem to like them starting a line.

Thanks,

Matt

Discussion

  • Matt
    Matt
    2013-08-25

    Argh! All of my templates have been mangled! I'll try again ...

      Thanks for astyle. Here are some indentation issues I found.
    
      The command line used was:
    
      astyle --mode=c --style=allman --indent-switches --indent-preprocessor --min-conditional-indent=0 --max-instatement-indent=120 --pad-oper --pad-paren --align-pointer=middle --align-reference=middle --add-brackets --formatted --recursive "lib/*.cc" "lib/*.h"
    
      Issue 1.
    
      namespace std
      {
      ..../// std::hash specialization for ptr.
      ....template < typename T >
      ....struct hash<matt::ptr<T> > :
      ....public __hash_base<size_t, matt::ptr<T> >
      ....{
      ........size_t operator() ( const matt::ptr<T> & o ) const noexcept
      ........{
      ............using ptr_T = matt::ptr<T>;
      ............return hash<typename ptr_T::pointer_type> () ( o.get () );
      ........}
      ....};
      }  // namespace std
    
      Issue 2.
    
      namespace matt
      {
      template < typename T >
      class ptr
      {
      public:
      ....template< typename = require_T<not_T<std::is_array<T>>>>
      ....explicit ptr ( pointer_type p ) noexcept :
      ........m_p ( p )
      ....{
      ....}
      }
      }
    
      Issue 3.
    
      When using ':' characters for base class definitions or initialisers,
      astyle definitely doesn't seem to like them starting a line.
    
      Thanks,
    
      Matt
    
     
  • Jim Pattee
    Jim Pattee
    2014-10-16

    I don't see the problem.
    The ':' is at the end of the line, not the start.
    It indents the inheritance line one indent, just as it should.
    With the template it aligns the template items.

    Without further information I will assume it is fixed.

     
  • Jim Pattee
    Jim Pattee
    2014-10-16

    • status: open --> open-fixed
    • assigned_to: Jim Pattee
    • Priority: 4 --> 7
     
  • Jim Pattee
    Jim Pattee
    2014-11-20

    • Status: open-fixed --> closed-fixed