From 0172e667e7a720f734555ac50e44b70b53cd3c40 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 11 Feb 2009 14:11:14 +0000 Subject: [PATCH] Use 'entries.back()' instead of '*--entries.end()' which is not only easier to read but also compiles with the SGI compiler. Re-indent inline functions. git-svn-id: https://svn.dealii.org/trunk@18363 0785d39b-7218-0410-832d-ea1e28bc413d --- .../lac/compressed_simple_sparsity_pattern.h | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/deal.II/lac/include/lac/compressed_simple_sparsity_pattern.h b/deal.II/lac/include/lac/compressed_simple_sparsity_pattern.h index 86e2eb4532..61ad00a6cb 100644 --- a/deal.II/lac/include/lac/compressed_simple_sparsity_pattern.h +++ b/deal.II/lac/include/lac/compressed_simple_sparsity_pattern.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -367,26 +367,29 @@ inline void CompressedSimpleSparsityPattern::Line::add (const unsigned int j) { - /* first check the last element (or if line is still empty) */ - if ( (entries.size()==0) || ( *(--entries.end()) < j) ) + // first check the last element (or if line + // is still empty) + if ( (entries.size()==0) || ( entries.back() < j) ) { - entries.push_back(j); - return; + entries.push_back(j); + return; } - /* do a binary search to find the place where to insert: */ - std::vector::iterator it = std::lower_bound(entries.begin(), - entries.end(), - j); - - /* If this entry is a duplicate, exit immediately */ - if (*it == j) - return; - - /* Insert at the right place in the vector. - Vector grows automatically to fit - elements. Always doubles its size.*/ - entries.insert(it, j); + // do a binary search to find the place + // where to insert: + std::vector::iterator it = std::lower_bound(entries.begin(), + entries.end(), + j); + + // If this entry is a duplicate, exit + // immediately + if (*it == j) + return; + + // Insert at the right place in the + // vector. Vector grows automatically to + // fit elements. Always doubles its size. + entries.insert(it, j); } @@ -412,7 +415,7 @@ CompressedSimpleSparsityPattern::n_cols () const inline void CompressedSimpleSparsityPattern::add (const unsigned int i, - const unsigned int j) + const unsigned int j) { Assert (i