Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hullo List,

A simple driveby patch that makes use of the standard library.

Cheers,

Kevin
From a2a9a1363a3a2ba0f7415295e7ebabb03acfe724 Mon Sep 17 00:00:00 2001
From: Kevin Hunter <hunteke@earlham.edu>
Date: Tue, 4 Oct 2011 18:56:18 -0400
Subject: [PATCH] Simplify logic to use std::vector's .empty()

No need to muck about with iterators, adding a loop, and 2 function
calls to test for empty: it's a std::vector under the hood, so use
.empty(), and inline it.
---
 autodoc/inc/ary_i/ci_text2.hxx           |    2 +-
 autodoc/source/ary_i/kernel/ci_text2.cxx |   12 ------------
 2 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/autodoc/inc/ary_i/ci_text2.hxx b/autodoc/inc/ary_i/ci_text2.hxx
index 8e1c202..eef1d63 100644
--- a/autodoc/inc/ary_i/ci_text2.hxx
+++ b/autodoc/inc/ary_i/ci_text2.hxx
@@ -72,7 +72,7 @@ class DocuTex2
                             DYN DocuToken &     let_drToken );
 
     const TokenList &   Tokens() const          { return aTokens; }
-    bool                IsEmpty() const;
+    bool                IsEmpty() const         { return aTokens.empty(); }
     const String &      TextOfFirstToken() const;
 
     String &            Access_TextOfFirstToken();
diff --git a/autodoc/source/ary_i/kernel/ci_text2.cxx b/autodoc/source/ary_i/kernel/ci_text2.cxx
index 00a5a7e..dea062f 100644
--- a/autodoc/source/ary_i/kernel/ci_text2.cxx
+++ b/autodoc/source/ary_i/kernel/ci_text2.cxx
@@ -76,18 +76,6 @@ DocuTex2::AddToken( DYN DocuToken & let_drToken )
     }
     aTokens.push_back(&let_drToken);
 }
-
-bool
-DocuTex2::IsEmpty() const
-{
-    for ( ary::inf::DocuTex2::TokenList::const_iterator
-                iter = aTokens.begin();
-          iter != aTokens.end();
-        )
-    {
-        return false;
-    }
-    return true;
 }
 
 using csi::dsapi::DT_TextToken;
-- 
1.7.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.