Replace all ConstArrayRef with ArrayRef<const T>
authorRoland Schulz <roland.schulz@intel.com>
Wed, 4 Oct 2017 06:48:49 +0000 (23:48 -0700)
committerBerk Hess <hess@kth.se>
Fri, 13 Oct 2017 07:18:39 +0000 (09:18 +0200)
1) Remove the alias itself in arrayref.h.
2) All replacements done automatically using sed:
s#ConstArrayRef<const char \*>#ArrayRef<const char *const>#
s#ConstArrayRef<\(.*\)>#ArrayRef<const \1>#

This worked because "const char*" was the only pointer type used as
template argument.

Change-Id: I5eba895a5dc235b95d77670b4f258e423f64f3b8

47 files changed:
src/gromacs/analysisdata/dataframe.h
src/gromacs/commandline/cmdlinehelpmodule.cpp
src/gromacs/commandline/cmdlinehelpwriter.cpp
src/gromacs/commandline/cmdlineoptionsmodule.cpp
src/gromacs/commandline/pargs.cpp
src/gromacs/commandline/tests/pargs.cpp
src/gromacs/ewald/tests/pmetestcommon.h
src/gromacs/gmxpreprocess/toppush.cpp
src/gromacs/mdlib/force.cpp
src/gromacs/mdlib/force.h
src/gromacs/mdlib/shellfc.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/onlinehelp/tests/helpwritercontext.cpp
src/gromacs/options/filenameoption.cpp
src/gromacs/options/filenameoptionmanager.cpp
src/gromacs/options/filenameoptionstorage.h
src/gromacs/options/optionstoragetemplate.h
src/gromacs/options/timeunitmanager.cpp
src/gromacs/selection/nbsearch.h
src/gromacs/selection/poscalc.cpp
src/gromacs/selection/selection.h
src/gromacs/selection/tests/nbsearch.cpp
src/gromacs/selection/tests/poscalc.cpp
src/gromacs/selection/tests/selectioncollection.cpp
src/gromacs/selection/tests/toputils.cpp
src/gromacs/simd/tests/simd_memory.cpp
src/gromacs/tables/cubicsplinetable.cpp
src/gromacs/tables/quadraticsplinetable.cpp
src/gromacs/tables/splineutil.cpp
src/gromacs/tables/splineutil.h
src/gromacs/tables/tableinput.h
src/gromacs/trajectoryanalysis/analysissettings.cpp
src/gromacs/trajectoryanalysis/modules/freevolume.cpp
src/gromacs/trajectoryanalysis/modules/sasa.cpp
src/gromacs/trajectoryanalysis/modules/select.cpp
src/gromacs/trajectoryanalysis/modules/surfacearea.cpp
src/gromacs/trajectoryanalysis/modules/surfacearea.h
src/gromacs/trajectoryanalysis/modules/unionfind.h
src/gromacs/trajectoryanalysis/tests/test_selection.cpp
src/gromacs/utility/arrayref.h
src/gromacs/utility/coolstuff.cpp
src/gromacs/utility/tests/arrayref.cpp
src/gromacs/utility/tests/stringutil.cpp
src/testutils/cmdlinetest.cpp
src/testutils/cmdlinetest.h
src/testutils/interactivetest.cpp
src/testutils/interactivetest.h

index 5502063042bdf347db0e104c194bfd92ea28c926..2646d0112711da97aa69c9af7ddd0e6aa298232c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -173,7 +173,7 @@ class AnalysisDataValue
 };
 
 //! Shorthand for reference to an array of data values.
-typedef ConstArrayRef<AnalysisDataValue> AnalysisDataValuesRef;
+typedef ArrayRef<const AnalysisDataValue> AnalysisDataValuesRef;
 
 
 /*! \brief
@@ -323,7 +323,7 @@ class AnalysisDataPointSetInfo
 };
 
 //! Shorthand for reference to an array of point set data objects.
-typedef ConstArrayRef<AnalysisDataPointSetInfo> AnalysisDataPointSetInfosRef;
+typedef ArrayRef<const AnalysisDataPointSetInfo> AnalysisDataPointSetInfosRef;
 
 //! \endcond
 
index 3157da330549b06e9e08833fe6d1f8b1286d1747..d8795362e8dea2b3816c46314d38b487b70b84de 100644 (file)
@@ -295,7 +295,7 @@ void RootHelpTopic::writeHelp(const HelpWriterContext &context) const
         cmdlineContext.setModuleDisplayName(helpModule_.binaryName_);
         optionsHolder.initOptions();
         Options                    &options = *optionsHolder.options();
-        ConstArrayRef<const char *> helpText;
+        ArrayRef<const char *const> helpText;
         if (context.outputFormat() != eHelpOutputFormat_Console)
         {
             helpText = RootHelpText::text;
index 482f2f2c55500ad76dca34399573c9f6df3812b0..0dcf90b666bbd587f4dc61fb89f7344fb63a1232 100644 (file)
@@ -499,7 +499,7 @@ class CommandLineHelpWriter::Impl
         //! Help text.
         std::string                  helpText_;
         //! List of bugs/knows issues.
-        ConstArrayRef<const char *>  bugs_;
+        ArrayRef<const char *const>  bugs_;
 };
 
 void CommandLineHelpWriter::Impl::formatBugs(const HelpWriterContext &context)
@@ -509,7 +509,7 @@ void CommandLineHelpWriter::Impl::formatBugs(const HelpWriterContext &context)
         return;
     }
     context.writeTitle("Known Issues");
-    ConstArrayRef<const char *>::const_iterator i;
+    ArrayRef<const char *const>::const_iterator i;
     for (i = bugs_.begin(); i != bugs_.end(); ++i)
     {
         const char *const       bug = *i;
@@ -546,7 +546,7 @@ CommandLineHelpWriter::setHelpText(const ArrayRef<const char *const> &help)
 }
 
 CommandLineHelpWriter &
-CommandLineHelpWriter::setKnownIssues(const ConstArrayRef<const char *> &bugs)
+CommandLineHelpWriter::setKnownIssues(const ArrayRef<const char *const> &bugs)
 {
     impl_->bugs_ = bugs;
     return *this;
index f0e6db73a3618fe08bbd12d12e22475f13e4875c..107441f3bb2a7d87f7a4342cdc3d28cdc1760528 100644 (file)
@@ -77,7 +77,7 @@ class CommandLineOptionsModuleSettings : public ICommandLineOptionsModuleSetting
 
         const std::string &helpText() const { return helpText_; }
 
-        virtual void setHelpText(const ConstArrayRef<const char *> &help)
+        virtual void setHelpText(const ArrayRef<const char *const> &help)
         {
             helpText_ = joinStrings(help, "\n");
         }
index 71ea05b52ca6f05c5341ecfc0dbabed71f95c965..c4419f7f03e2f7b8e7feef5b7e171001cb7e3569 100644 (file)
@@ -201,12 +201,12 @@ namespace
  *
  * \ingroup module_commandline
  */
-int getDefaultXvgFormat(gmx::ConstArrayRef<const char *> xvgFormats)
+int getDefaultXvgFormat(gmx::ArrayRef<const char *const> xvgFormats)
 {
     const char *const select = getenv("GMX_VIEW_XVG");
     if (select != nullptr)
     {
-        ConstArrayRef<const char *>::const_iterator i =
+        ArrayRef<const char *const>::const_iterator i =
             std::find(xvgFormats.begin(), xvgFormats.end(), std::string(select));
         if (i != xvgFormats.end())
         {
index 876862acf9c674b8ccfa90779bf70e79dea301a9..00f97fa3967e944d01c6d507625a811656b8eae5 100644 (file)
@@ -96,7 +96,7 @@ class ParseCommonArgsTest : public ::testing::Test
                                          0, nullptr, 0, nullptr, &oenv_);
             EXPECT_TRUE(bOk);
         }
-        void parseFromArray(gmx::ConstArrayRef<const char *> cmdline,
+        void parseFromArray(gmx::ArrayRef<const char *const> cmdline,
                             unsigned long                    flags,
                             gmx::ArrayRef<t_filenm>          fnm,
                             gmx::ArrayRef<t_pargs>           pa)
index f58724444ff59997b17d9ada622cf4b6bc1d4ec7..51f410fa2c30465ddfbb066da3a8d837f5500cd1 100644 (file)
@@ -65,17 +65,17 @@ namespace test
 //! A safe pointer type for PME.
 typedef gmx::unique_cptr<gmx_pme_t, gmx_pme_destroy> PmeSafePointer;
 //! Charges
-typedef ConstArrayRef<real> ChargesVector;
+typedef ArrayRef<const real> ChargesVector;
 //! Coordinates
 typedef std::vector<RVec> CoordinatesVector;
 //! Forces
 typedef ArrayRef<RVec> ForcesVector;
 //! Gridline indices
-typedef ConstArrayRef<IVec> GridLineIndicesVector;
+typedef ArrayRef<const IVec> GridLineIndicesVector;
 /*! \brief Spline parameters (theta or dtheta).
  * A reference to a single dimension's spline data; this means (atomCount * pmeOrder) values or derivatives.
  */
-typedef ConstArrayRef<real> SplineParamsDimVector;
+typedef ArrayRef<const real> SplineParamsDimVector;
 /*! \brief Spline parameters (theta or dtheta) in all 3 dimensions
  */
 typedef std::array<SplineParamsDimVector, DIM> SplineParamsVector;
index 2abdf809033d32e0c0538199981f9aac6b6158bd..17799f643d78fe4b77aee9a702f2951f2a133942 100644 (file)
@@ -541,7 +541,7 @@ void push_at (t_symtab *symtab, gpp_atomtype_t at, t_bond_atomtype bat,
 
 //! Return whether the contents of \c a and \c b are the same, considering also reversed order.
 template <typename T>
-static bool equalEitherForwardOrBackward(gmx::ConstArrayRef<T> a, gmx::ConstArrayRef<T> b)
+static bool equalEitherForwardOrBackward(gmx::ArrayRef<const T> a, gmx::ArrayRef<const T> b)
 {
     return (std::equal(a.begin(), a.end(), b.begin()) ||
             std::equal(a.begin(), a.end(), b.rbegin()));
@@ -590,8 +590,8 @@ static void push_bondtype(t_params     *       bt,
     bool haveErrored = false;
     for (int i = 0; (i < nr); i++)
     {
-        gmx::ConstArrayRef<int> bParams(b->a, b->a + nral);
-        gmx::ConstArrayRef<int> testParams(bt->param[i].a, bt->param[i].a + nral);
+        gmx::ArrayRef<const int> bParams(b->a, b->a + nral);
+        gmx::ArrayRef<const int> testParams(bt->param[i].a, bt->param[i].a + nral);
         if (equalEitherForwardOrBackward(bParams, testParams))
         {
             GMX_ASSERT(nrfp <= MAXFORCEPARAM, "This is ensured in other places, but we need this assert to keep the clang analyzer happy");
index 676b9b698b0598b30363afa4db9d69a025193f2f..474293ab5f6aa734609dd02f93c4a3a9e777b239 100644 (file)
@@ -718,7 +718,7 @@ void sum_epot(gmx_grppairener_t *grpp, real *epot)
     }
 }
 
-void sum_dhdl(gmx_enerdata_t *enerd, gmx::ConstArrayRef<real> lambda, t_lambda *fepvals)
+void sum_dhdl(gmx_enerdata_t *enerd, gmx::ArrayRef<const real> lambda, t_lambda *fepvals)
 {
     int    index;
     double dlam;
index 39945517390b8d9ddf34b6bd3101d36b3039020b..6cfe0c14044d3a366121561599ca3e8920e8a5ff 100644 (file)
@@ -143,7 +143,7 @@ void reset_enerdata(gmx_enerdata_t *enerd);
 void sum_epot(gmx_grppairener_t *grpp, real *epot);
 /* Locally sum the non-bonded potential energy terms */
 
-void sum_dhdl(gmx_enerdata_t *enerd, gmx::ConstArrayRef<real> lambda, t_lambda *fepvals);
+void sum_dhdl(gmx_enerdata_t *enerd, gmx::ArrayRef<const real> lambda, t_lambda *fepvals);
 /* Sum the free energy contributions */
 
 /* Compute the average C6 and C12 params for LJ corrections */
index 0ceaba79234b100a1e2af3a87949a2a09e7e16ed..d0e9962fd59ebf6d4cb1589ead31517ed7fa18f1 100644 (file)
@@ -896,7 +896,7 @@ static void init_adir(FILE *log, gmx_shellfc_t *shfc,
                       rvec *x_old, rvec *x_init, rvec *x,
                       rvec *f, rvec *acc_dir,
                       gmx_bool bMolPBC, matrix box,
-                      gmx::ConstArrayRef<real> lambda, real *dvdlambda,
+                      gmx::ArrayRef<const real> lambda, real *dvdlambda,
                       t_nrnb *nrnb)
 {
     rvec           *xnold, *xnew;
index 32e4fac103a572a8dafefc99d566a937ea013dad..ce2a476b369be7de54dc2473a9411700f3eb5a02 100644 (file)
@@ -210,7 +210,7 @@ void print_start(FILE *fplog, t_commrec *cr,
                         walltime_accounting_get_start_time_stamp(walltime_accounting));
 }
 
-static void sum_forces(rvec f[], gmx::ConstArrayRef<gmx::RVec> forceToAdd)
+static void sum_forces(rvec f[], gmx::ArrayRef<const gmx::RVec> forceToAdd)
 {
     const int end = forceToAdd.size();
 
index 205906f435e2f2542b0cbfa1974d4bc870d4645f..05fc10b1333d9398ce88e5686fd53a7ac70b831c 100644 (file)
@@ -86,7 +86,7 @@ class HelpWriterContextTest : public gmx::test::StringTestBase
             }
             checkText(result, id);
         }
-        void testFormatting(const gmx::ConstArrayRef<const char *> &text)
+        void testFormatting(const gmx::ArrayRef<const char *const> &text)
         {
             std::string testText = gmx::joinStrings(text, "\n");
             testFormatting(testText, gmx::eHelpOutputFormat_Console, nullptr);
index e1e431a88cf57e1349568184786af738dcb63d32..f3c12b9b5dec0a94b2e8ea6520c392995c2cd700 100644 (file)
@@ -215,8 +215,8 @@ FileNameOptionStorage::FileNameOptionStorage(const FileNameOption  &settings,
     }
     else
     {
-        ConstArrayRef<FileTypeMapping>                 map(c_fileTypeMapping);
-        ConstArrayRef<FileTypeMapping>::const_iterator i;
+        ArrayRef<const FileTypeMapping>                 map(c_fileTypeMapping);
+        ArrayRef<const FileTypeMapping>::const_iterator i;
         for (i = map.begin(); i != map.end(); ++i)
         {
             if (i->optionType == settings.optionType_)
@@ -434,11 +434,11 @@ bool FileNameOptionStorage::isValidType(int fileType) const
     return typeHandler.isValidType(fileType);
 }
 
-ConstArrayRef<int> FileNameOptionStorage::fileTypes() const
+ArrayRef<const int> FileNameOptionStorage::fileTypes() const
 {
     if (fileType_ < 0)
     {
-        return ConstArrayRef<int>();
+        return ArrayRef<const int>();
     }
     const int genericTypeCount = ftp2generic_count(fileType_);
     if (genericTypeCount > 0)
@@ -512,7 +512,7 @@ bool FileNameOptionInfo::isValidType(int fileType) const
     return option().isValidType(fileType);
 }
 
-ConstArrayRef<int> FileNameOptionInfo::fileTypes() const
+ArrayRef<const int> FileNameOptionInfo::fileTypes() const
 {
     return option().fileTypes();
 }
index 3c746b01fd2f825ecca725871ef0604ab6a68ea4..7c9fefa88423c19ccf833590b3d8925a5fcf9b2d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -83,8 +83,8 @@ std::string findExistingExtension(const std::string                  &prefix,
                                   const FileNameOptionInfo           &option,
                                   const IFileInputRedirector         *redirector)
 {
-    ConstArrayRef<int>                 types = option.fileTypes();
-    ConstArrayRef<int>::const_iterator i;
+    ArrayRef<const int>                 types = option.fileTypes();
+    ArrayRef<const int>::const_iterator i;
     for (i = types.begin(); i != types.end(); ++i)
     {
         std::string testFilename(prefix + ftp2ext_with_dot(*i));
@@ -185,8 +185,8 @@ std::string FileNameOptionManager::completeFileName(
         if (fileType == efNR
             && impl_->redirector_->fileExists(value, File::throwOnError))
         {
-            ConstArrayRef<const char *>                 compressedExtensions(c_compressedExtensions);
-            ConstArrayRef<const char *>::const_iterator ext;
+            ArrayRef<const char *const>                 compressedExtensions(c_compressedExtensions);
+            ArrayRef<const char *const>::const_iterator ext;
             for (ext = compressedExtensions.begin(); ext != compressedExtensions.end(); ++ext)
             {
                 if (endsWith(value, *ext))
index 97fda90324b99ce8d9adb8780d0acf496fa3cba9..76f18273b81bafa7a6aaab4a0e87d7c7296e16d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -97,7 +97,7 @@ class FileNameOptionStorage : public OptionStorageTemplateSimple<std::string>
         //! \copydoc FileNameOptionInfo::isValidType()
         bool isValidType(int fileType) const;
         //! \copydoc FileNameOptionInfo::fileTypes()
-        ConstArrayRef<int> fileTypes() const;
+        ArrayRef<const int> fileTypes() const;
 
     private:
         virtual void initConverter(ConverterType *converter);
index d2d9dac15ffbd2b143770456a15d2b81e47e3906..c748bc303e6ecd61632c536dee345d680ed58ff9 100644 (file)
@@ -260,9 +260,9 @@ class OptionStorageTemplate : public AbstractOptionStorage
          * The non-const variant should only be used from processAll() in
          * derived classes if necessary.
          */
-        ArrayRef<T>      values() { return store_->values(); }
+        ArrayRef<T>       values() { return store_->values(); }
         //! Provides derived classes access to the current list of values.
-        ConstArrayRef<T> values() const { return store_->values(); }
+        ArrayRef<const T> values() const { return store_->values(); }
 
     private:
         //! Creates the internal storage object for final values..
index 4a4e9af6f5036278783d978ef4202c0884b9ae57..49b2c7023e993ee3d67ab5e6c110cd816c16c686 100644 (file)
@@ -149,8 +149,8 @@ void TimeUnitBehavior::setTimeUnitFromEnvironment()
     const char *const value = std::getenv("GMXTIMEUNIT");
     if (value != nullptr)
     {
-        ConstArrayRef<const char *>                 timeUnits(g_timeUnits);
-        ConstArrayRef<const char *>::const_iterator i =
+        ArrayRef<const char *const>                 timeUnits(g_timeUnits);
+        ArrayRef<const char *const>::const_iterator i =
             std::find(timeUnits.begin(), timeUnits.end(), std::string(value));
         if (i == timeUnits.end())
         {
index 0561822a68c0a7fb38ac5337c414c2697a68a132..86bafacaf47a2d8b6f0b9fe5424c5cdc07aebd5a 100644 (file)
@@ -136,7 +136,7 @@ class AnalysisNeighborhoodPositions
          * AnalysisNeighborhood::setTopologyExclusions().
          */
         AnalysisNeighborhoodPositions &
-        exclusionIds(ConstArrayRef<int> ids)
+        exclusionIds(ArrayRef<const int> ids)
         {
             GMX_ASSERT(static_cast<int>(ids.size()) == count_,
                        "Exclusion id array should match the number of positions");
@@ -152,7 +152,7 @@ class AnalysisNeighborhoodPositions
          * indices to the \p indices array passed here.
          */
         AnalysisNeighborhoodPositions &
-        indexed(ConstArrayRef<int> indices)
+        indexed(ArrayRef<const int> indices)
         {
             count_   = indices.size();
             indices_ = indices.data();
index 6617cd7859a32ab08f38536eb3f2d4ac2f9c3c53..0fe921501c4a081a1e1367688180a7bfa983e3cc 100644 (file)
@@ -127,7 +127,7 @@ class PositionCalculationCollection::Impl
          * there are also other thread-unsafe constructs here), so a temporary
          * array is used to avoid repeated memory allocation.
          */
-        ConstArrayRef<int> getFrameIndices(int size, int index[])
+        ArrayRef<const int> getFrameIndices(int size, int index[])
         {
             if (mapToFrameAtoms_.empty())
             {
@@ -1330,9 +1330,9 @@ gmx_ana_poscalc_update(gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p,
                 clear_rvec(p->f[i]);
             }
         }
-        gmx::ConstArrayRef<int> index = pc->coll->getFrameIndices(pc->b.nra, pc->b.a);
-        const gmx_mtop_t       *top   = pc->coll->top_;
-        const bool              bMass = pc->flags & POS_MASS;
+        gmx::ArrayRef<const int> index = pc->coll->getFrameIndices(pc->b.nra, pc->b.a);
+        const gmx_mtop_t        *top   = pc->coll->top_;
+        const bool               bMass = pc->flags & POS_MASS;
         switch (pc->type)
         {
             case POS_ATOM:
index 3ff3dadeff0cd1eac98c20475ae44c6feff2c162..51424d881130072d456fe63a1cfe4bee9441d5f7 100644 (file)
@@ -337,7 +337,7 @@ class Selection
             return data().rawPositions_.m.mapb.nra;
         }
         //! Returns atom indices of all atoms in the selection.
-        ConstArrayRef<int> atomIndices() const
+        ArrayRef<const int> atomIndices() const
         {
             return constArrayRefFromArray(sel_->rawPositions_.m.mapb.a,
                                           sel_->rawPositions_.m.mapb.nra);
@@ -347,7 +347,7 @@ class Selection
         //! Access a single position.
         SelectionPosition position(int i) const;
         //! Returns coordinates for this selection as a continuous array.
-        ConstArrayRef<rvec> coordinates() const
+        ArrayRef<const rvec> coordinates() const
         {
             return constArrayRefFromArray(data().rawPositions_.x, posCount());
         }
@@ -358,7 +358,7 @@ class Selection
          *
          * Must not be called if hasVelocities() returns false.
          */
-        ConstArrayRef<rvec> velocities() const
+        ArrayRef<const rvec> velocities() const
         {
             GMX_ASSERT(hasVelocities(), "Velocities accessed, but unavailable");
             return constArrayRefFromArray(data().rawPositions_.v, posCount());
@@ -370,13 +370,13 @@ class Selection
          *
          * Must not be called if hasForces() returns false.
          */
-        ConstArrayRef<rvec> forces() const
+        ArrayRef<const rvec> forces() const
         {
             GMX_ASSERT(hasForces(), "Forces accessed, but unavailable");
             return constArrayRefFromArray(data().rawPositions_.f, posCount());
         }
         //! Returns masses for this selection as a continuous array.
-        ConstArrayRef<real> masses() const
+        ArrayRef<const real> masses() const
         {
             // posMass_ may have more entries than posCount() in the case of
             // dynamic selections that don't have a topology
@@ -387,7 +387,7 @@ class Selection
                                                  data().posMass_.begin() + posCount());
         }
         //! Returns charges for this selection as a continuous array.
-        ConstArrayRef<real> charges() const
+        ArrayRef<const real> charges() const
         {
             // posCharge_ may have more entries than posCount() in the case of
             // dynamic selections that don't have a topology
@@ -402,7 +402,7 @@ class Selection
          *
          * \see SelectionPosition::refId()
          */
-        ConstArrayRef<int> refIds() const
+        ArrayRef<const int> refIds() const
         {
             return constArrayRefFromArray(data().rawPositions_.m.refid, posCount());
         }
@@ -411,7 +411,7 @@ class Selection
          *
          * \see SelectionPosition::mappedId()
          */
-        ConstArrayRef<int> mappedIds() const
+        ArrayRef<const int> mappedIds() const
         {
             return constArrayRefFromArray(data().rawPositions_.m.mapid, posCount());
         }
@@ -688,12 +688,12 @@ class SelectionPosition
                    - sel_->rawPositions_.m.mapb.index[i_];
         }
         //! Return atom indices that make up this position.
-        ConstArrayRef<int> atomIndices() const
+        ArrayRef<const int> atomIndices() const
         {
             const int *atoms = sel_->rawPositions_.m.mapb.a;
             if (atoms == nullptr)
             {
-                return ConstArrayRef<int>();
+                return ArrayRef<const int>();
             }
             const int first = sel_->rawPositions_.m.mapb.index[i_];
             return constArrayRefFromArray(&atoms[first], atomCount());
index dae59c0ba09616af01d61b8b65d3c638ec0c3c65..78ee37a17a9aea1a9835ad480386b21a6789b7e4 100644 (file)
@@ -329,12 +329,12 @@ class ExclusionsHelper
 
         const t_blocka *exclusions() const { return &excls_; }
 
-        gmx::ConstArrayRef<int> refPosIds() const
+        gmx::ArrayRef<const int> refPosIds() const
         {
             return gmx::constArrayRefFromVector<int>(exclusionIds_.begin(),
                                                      exclusionIds_.begin() + refPosCount_);
         }
-        gmx::ConstArrayRef<int> testPosIds() const
+        gmx::ArrayRef<const int> testPosIds() const
         {
             return gmx::constArrayRefFromVector<int>(exclusionIds_.begin(),
                                                      exclusionIds_.begin() + testPosCount_);
@@ -434,8 +434,8 @@ class NeighborhoodSearchTest : public ::testing::Test
                                 const NeighborhoodSearchTestData         &data,
                                 const gmx::AnalysisNeighborhoodPositions &pos,
                                 const t_blocka                           *excls,
-                                const gmx::ConstArrayRef<int>            &refIndices,
-                                const gmx::ConstArrayRef<int>            &testIndices,
+                                const gmx::ArrayRef<const int>           &refIndices,
+                                const gmx::ArrayRef<const int>           &testIndices,
                                 bool                                      selfPairs);
 
         gmx::AnalysisNeighborhood        nb_;
@@ -552,8 +552,8 @@ void NeighborhoodSearchTest::testPairSearchFull(
         const NeighborhoodSearchTestData         &data,
         const gmx::AnalysisNeighborhoodPositions &pos,
         const t_blocka                           *excls,
-        const gmx::ConstArrayRef<int>            &refIndices,
-        const gmx::ConstArrayRef<int>            &testIndices,
+        const gmx::ArrayRef<const int>           &refIndices,
+        const gmx::ArrayRef<const int>           &testIndices,
         bool                                      selfPairs)
 {
     std::map<int, RefPairList> refPairs;
index 00e22a5acc6615202b1c9fd11e2d0dae5cf87099..7daa1b4fb106b87fb61e28bfce4abda018cc40bc 100644 (file)
@@ -76,22 +76,22 @@ class PositionCalculationTest : public ::testing::Test
         void generateCoordinates();
 
         gmx_ana_poscalc_t *createCalculation(e_poscalc_t type, int flags);
-        void setMaximumGroup(gmx_ana_poscalc_t *pc, const gmx::ConstArrayRef<int> &atoms);
+        void setMaximumGroup(gmx_ana_poscalc_t *pc, const gmx::ArrayRef<const int> &atoms);
         gmx_ana_pos_t *initPositions(gmx_ana_poscalc_t *pc, const char *name);
 
         void checkInitialized();
         void updateAndCheck(gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p,
-                            const gmx::ConstArrayRef<int> &atoms,
+                            const gmx::ArrayRef<const int> &atoms,
                             gmx::test::TestReferenceChecker *checker,
                             const char *name);
 
         void testSingleStatic(e_poscalc_t type, int flags, bool bExpectTop,
-                              const gmx::ConstArrayRef<int> &atoms,
-                              const gmx::ConstArrayRef<int> &index = gmx::EmptyArrayRef());
+                              const gmx::ArrayRef<const int> &atoms,
+                              const gmx::ArrayRef<const int> &index = gmx::EmptyArrayRef());
         void testSingleDynamic(e_poscalc_t type, int flags, bool bExpectTop,
-                               const gmx::ConstArrayRef<int> &initAtoms,
-                               const gmx::ConstArrayRef<int> &evalAtoms,
-                               const gmx::ConstArrayRef<int> &index = gmx::EmptyArrayRef());
+                               const gmx::ArrayRef<const int> &initAtoms,
+                               const gmx::ArrayRef<const int> &evalAtoms,
+                               const gmx::ArrayRef<const int> &index = gmx::EmptyArrayRef());
 
         gmx::test::TestReferenceData        data_;
         gmx::test::TestReferenceChecker     checker_;
@@ -185,8 +185,8 @@ PositionCalculationTest::createCalculation(e_poscalc_t type, int flags)
     return pcList_.back();
 }
 
-void PositionCalculationTest::setMaximumGroup(gmx_ana_poscalc_t             *pc,
-                                              const gmx::ConstArrayRef<int> &atoms)
+void PositionCalculationTest::setMaximumGroup(gmx_ana_poscalc_t              *pc,
+                                              const gmx::ArrayRef<const int> &atoms)
 {
     setTopologyIfRequired();
     gmx_ana_index_t g;
@@ -218,7 +218,7 @@ void PositionCalculationTest::checkInitialized()
 }
 
 void PositionCalculationTest::updateAndCheck(
-        gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p, const gmx::ConstArrayRef<int> &atoms,
+        gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p, const gmx::ArrayRef<const int> &atoms,
         gmx::test::TestReferenceChecker *checker, const char *name)
 {
     gmx_ana_index_t g;
@@ -230,8 +230,8 @@ void PositionCalculationTest::updateAndCheck(
 
 void PositionCalculationTest::testSingleStatic(
         e_poscalc_t type, int flags, bool bExpectTop,
-        const gmx::ConstArrayRef<int> &atoms,
-        const gmx::ConstArrayRef<int> &index)
+        const gmx::ArrayRef<const int> &atoms,
+        const gmx::ArrayRef<const int> &index)
 {
     t_trxframe *frame = topManager_.frame();
     if (frame->bV)
@@ -266,9 +266,9 @@ void PositionCalculationTest::testSingleStatic(
 
 void PositionCalculationTest::testSingleDynamic(
         e_poscalc_t type, int flags, bool bExpectTop,
-        const gmx::ConstArrayRef<int> &initAtoms,
-        const gmx::ConstArrayRef<int> &evalAtoms,
-        const gmx::ConstArrayRef<int> &index)
+        const gmx::ArrayRef<const int> &initAtoms,
+        const gmx::ArrayRef<const int> &evalAtoms,
+        const gmx::ArrayRef<const int> &index)
 {
     gmx_ana_poscalc_t *pc = createCalculation(type, flags | POS_DYNAMIC);
     const bool         requiresTopology
index 356f2e7beb626e9ef88fd54fb3212670b6449d79..6dcfeac7f73c0d9b45cd14acf8e34a7a1a441338 100644 (file)
@@ -161,7 +161,7 @@ class SelectionCollectionInteractiveTest : public SelectionCollectionTest
         }
 
         void runTest(int count, bool bInteractive,
-                     const gmx::ConstArrayRef<const char *> &input);
+                     const gmx::ArrayRef<const char *const> &input);
 
         gmx::test::TestReferenceData      data_;
         gmx::test::InteractiveTestHelper  helper_;
@@ -169,7 +169,7 @@ class SelectionCollectionInteractiveTest : public SelectionCollectionTest
 
 void SelectionCollectionInteractiveTest::runTest(
         int count, bool bInteractive,
-        const gmx::ConstArrayRef<const char *> &inputLines)
+        const gmx::ArrayRef<const char *const> &inputLines)
 {
     helper_.setInputLines(inputLines);
     // TODO: Check something about the returned selections as well.
@@ -208,15 +208,15 @@ class SelectionCollectionDataTest : public SelectionCollectionTest
 
         void setFlags(TestFlags flags) { flags_ = flags; }
 
-        void runParser(const gmx::ConstArrayRef<const char *> &selections);
+        void runParser(const gmx::ArrayRef<const char *const> &selections);
         void runCompiler();
         void runEvaluate();
         void runEvaluateFinal();
 
         void runTest(int                                     natoms,
-                     const gmx::ConstArrayRef<const char *> &selections);
+                     const gmx::ArrayRef<const char *const> &selections);
         void runTest(const char                             *filename,
-                     const gmx::ConstArrayRef<const char *> &selections);
+                     const gmx::ArrayRef<const char *const> &selections);
 
     private:
         static void checkSelection(gmx::test::TestReferenceChecker *checker,
@@ -240,7 +240,7 @@ SelectionCollectionDataTest::checkSelection(
     using gmx::test::TestReferenceChecker;
 
     {
-        gmx::ConstArrayRef<int> atoms = sel.atomIndices();
+        gmx::ArrayRef<const int> atoms = sel.atomIndices();
         checker->checkSequence(atoms.begin(), atoms.end(), "Atoms");
     }
     if (flags.test(efTestPositionAtoms)
@@ -257,7 +257,7 @@ SelectionCollectionDataTest::checkSelection(
             const gmx::SelectionPosition &p = sel.position(i);
             if (flags.test(efTestPositionAtoms))
             {
-                gmx::ConstArrayRef<int> atoms = p.atomIndices();
+                gmx::ArrayRef<const int> atoms = p.atomIndices();
                 poscompound.checkSequence(atoms.begin(), atoms.end(), "Atoms");
             }
             if (flags.test(efTestPositionCoordinates))
@@ -284,7 +284,7 @@ SelectionCollectionDataTest::checkSelection(
 
 void
 SelectionCollectionDataTest::runParser(
-        const gmx::ConstArrayRef<const char *> &selections)
+        const gmx::ArrayRef<const char *const> &selections)
 {
     using gmx::test::TestReferenceChecker;
 
@@ -391,7 +391,7 @@ SelectionCollectionDataTest::runEvaluateFinal()
 
 void
 SelectionCollectionDataTest::runTest(
-        int natoms, const gmx::ConstArrayRef<const char *> &selections)
+        int natoms, const gmx::ArrayRef<const char *const> &selections)
 {
     ASSERT_NO_FATAL_FAILURE(runParser(selections));
     ASSERT_NO_FATAL_FAILURE(setAtomCount(natoms));
@@ -401,7 +401,7 @@ SelectionCollectionDataTest::runTest(
 
 void
 SelectionCollectionDataTest::runTest(
-        const char *filename, const gmx::ConstArrayRef<const char *> &selections)
+        const char *filename, const gmx::ArrayRef<const char *const> &selections)
 {
     ASSERT_NO_FATAL_FAILURE(runParser(selections));
     ASSERT_NO_FATAL_FAILURE(loadTopology(filename));
index 975ce6e331a1d4463157d2ab8caa9a63f0e2c175..79eecdf31a53aad78c96498b6332644203246997 100644 (file)
@@ -191,7 +191,7 @@ void TopologyManager::initAtoms(int count)
     }
 }
 
-void TopologyManager::initAtomTypes(const ConstArrayRef<const char *> &types)
+void TopologyManager::initAtomTypes(const ArrayRef<const char *const> &types)
 {
     GMX_RELEASE_ASSERT(mtop_ != nullptr, "Topology not initialized");
     atomtypes_.reserve(types.size());
@@ -244,7 +244,7 @@ void TopologyManager::initUniformMolecules(int moleculeSize)
     mtop_->mols.index[mtop_->mols.nr] = mtop_->natoms;
 }
 
-void TopologyManager::initFrameIndices(const ConstArrayRef<int> &index)
+void TopologyManager::initFrameIndices(const ArrayRef<const int> &index)
 {
     GMX_RELEASE_ASSERT(frame_ != nullptr, "Frame not initialized");
     GMX_RELEASE_ASSERT(!frame_->bIndex, "Frame atom indices can only be set once");
index 0c4e0b520b5b100c5281df90e52a2180344b7c3e..55b1893adf2832e0500d7b5a9f9f87924a23f5c3 100644 (file)
@@ -66,15 +66,6 @@ TEST(EmptyArrayRefTest, IsEmpty)
     EXPECT_TRUE(empty.empty());
 }
 
-TEST(EmptyConstArrayRefTest, IsEmpty)
-{
-    EmptyArrayRef           emptyArray = {};
-    ConstArrayRef<SimdReal> empty(emptyArray);
-
-    EXPECT_EQ(0U, empty.size());
-    EXPECT_TRUE(empty.empty());
-}
-
 #ifdef GTEST_HAS_TYPED_TEST
 
 /*! \brief Permit all the tests to run on all kinds of ArrayRefs
index f0b589ea8bb1ab7a209845aec8b41ba64bcebf9c..502b9bcb841de2806b5c52cd5d2b6810364c4473 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -220,8 +220,8 @@ fillSingleCubicSplineTableData(const std::function<double(double)>   &function,
  * \param[out] yfghTableData        Output cubic spline table with Y,F,G,H entries
  */
 void
-fillSingleCubicSplineTableData(ConstArrayRef<double>                  function,
-                               ConstArrayRef<double>                  derivative,
+fillSingleCubicSplineTableData(ArrayRef<const double>                 function,
+                               ArrayRef<const double>                 derivative,
                                double                                 inputSpacing,
                                const std::pair<real, real>           &range,
                                double                                 spacing,
index 94dc2b31bb29c69cc343b327ed9c48c2503139b6..7a85cda2353a6b952922d83c36cf57354f018334 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -154,8 +154,8 @@ fillSingleQuadraticSplineTableData(const std::function<double(double)>   &functi
  * \param[out] derivativeTableData  OUtput table with (adjusted) derivative data
  */
 void
-fillSingleQuadraticSplineTableData(ConstArrayRef<double>                  function,
-                                   ConstArrayRef<double>                  derivative,
+fillSingleQuadraticSplineTableData(ArrayRef<const double>                 function,
+                                   ArrayRef<const double>                 derivative,
                                    double                                 inputSpacing,
                                    const std::pair<real, real>           &range,
                                    double                                 spacing,
index 1e4452e209b97b14256af663cecb8b99b6876ace..94c9228fe6f06e9c528175e3b306083ce827adf5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -108,8 +108,8 @@ throwUnlessDerivativeIsConsistentWithFunction(const std::function<double(double)
 
 
 void
-throwUnlessDerivativeIsConsistentWithFunction(ConstArrayRef<double>         function,
-                                              ConstArrayRef<double>         derivative,
+throwUnlessDerivativeIsConsistentWithFunction(ArrayRef<const double>        function,
+                                              ArrayRef<const double>        derivative,
                                               double                        inputSpacing,
                                               const std::pair<real, real>  &range)
 {
@@ -203,7 +203,7 @@ findSmallestQuotientOfFunctionAndSecondDerivative(const std::function<double(dou
 
 
 real
-findSmallestQuotientOfFunctionAndSecondDerivative(ConstArrayRef<double>         function,
+findSmallestQuotientOfFunctionAndSecondDerivative(ArrayRef<const double>        function,
                                                   double                        inputSpacing,
                                                   const std::pair<real, real>   &range)
 {
@@ -277,7 +277,7 @@ findSmallestQuotientOfFunctionAndThirdDerivative(const std::function<double(doub
 
 
 real
-findSmallestQuotientOfFunctionAndThirdDerivative(ConstArrayRef<double>         function,
+findSmallestQuotientOfFunctionAndThirdDerivative(ArrayRef<const double>        function,
                                                  double                        inputSpacing,
                                                  const std::pair<real, real>   &range)
 {
@@ -296,7 +296,7 @@ findSmallestQuotientOfFunctionAndThirdDerivative(ConstArrayRef<double>         f
 
 
 std::vector<double>
-vectorSecondDerivative(ConstArrayRef<double> f, double spacing)
+vectorSecondDerivative(ArrayRef<const double> f, double spacing)
 {
     if (f.size() < 5)
     {
index bbf8cdd772dedfacc67b26ad4cbb9f3d27b66087..77b2a160f9841fde1cc06eaca0eee0e6a8d3ffea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -104,8 +104,8 @@ throwUnlessDerivativeIsConsistentWithFunction(const std::function<double(double)
  *        to avoid accuracy loss.
  */
 void
-throwUnlessDerivativeIsConsistentWithFunction(ConstArrayRef<double>         function,
-                                              ConstArrayRef<double>         derivative,
+throwUnlessDerivativeIsConsistentWithFunction(ArrayRef<const double>        function,
+                                              ArrayRef<const double>        derivative,
                                               double                        inputSpacing,
                                               const std::pair<real, real>  &range);
 
@@ -175,7 +175,7 @@ findSmallestQuotientOfFunctionAndSecondDerivative(const std::function<double(dou
  *        avoid accuracy loss.
  */
 real
-findSmallestQuotientOfFunctionAndSecondDerivative(ConstArrayRef<double>         function,
+findSmallestQuotientOfFunctionAndSecondDerivative(ArrayRef<const double>        function,
                                                   double                        inputSpacing,
                                                   const std::pair<real, real>  &range);
 
@@ -245,7 +245,7 @@ findSmallestQuotientOfFunctionAndThirdDerivative(const std::function<double(doub
  *        avoid accuracy loss.
  */
 real
-findSmallestQuotientOfFunctionAndThirdDerivative(ConstArrayRef<double>         function,
+findSmallestQuotientOfFunctionAndThirdDerivative(ArrayRef<const double>        function,
                                                  double                        inputSpacing,
                                                  const std::pair<real, real>  &range);
 
@@ -264,7 +264,7 @@ findSmallestQuotientOfFunctionAndThirdDerivative(ConstArrayRef<double>         f
  *       accuracy loss (since differentiation can be numerically fragile).
  */
 std::vector<double>
-vectorSecondDerivative(ConstArrayRef<double>        f,
+vectorSecondDerivative(ArrayRef<const double>       f,
                        double                       spacing);
 
 
index 08b66c20cb371eeca21323414f1e60c01f8b0378..8f8725c53c089766e14c3a5ba9e04cf3ccc1090e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -69,8 +69,8 @@ struct
 NumericalSplineTableInput
 {
     const std::string                    &desc;        //!< \libinternal Brief description of function
-    ConstArrayRef<double>                 function;    //!< \libinternal Vector with function values
-    ConstArrayRef<double>                 derivative;  //!< \libinternal Vector with derivative values
+    ArrayRef<const double>                function;    //!< \libinternal Vector with function values
+    ArrayRef<const double>                derivative;  //!< \libinternal Vector with derivative values
     double                                spacing;     //!< \libinternal Distance between data points
 };
 
index 4b1e935be6f6dac724448977dccd0a14cac54f14..56df3ab97e25647454725b902361510d864a26ee 100644 (file)
@@ -173,7 +173,7 @@ TrajectoryAnalysisSettings::setFrameFlags(int frflags)
 }
 
 void
-TrajectoryAnalysisSettings::setHelpText(const ConstArrayRef<const char *> &help)
+TrajectoryAnalysisSettings::setHelpText(const ArrayRef<const char *const> &help)
 {
     GMX_RELEASE_ASSERT(impl_->optionsModuleSettings_ != nullptr,
                        "setHelpText() called in invalid context");
index faa8078eec9cb512973abe6eee208bf1727646ad..04561e89e2a09b6f15b96052f9c738be1f1fa695 100644 (file)
@@ -246,9 +246,9 @@ FreeVolume::initAnalysis(const TrajectoryAnalysisSettings &settings,
     nmol_ = top.topology()->mols.nr;
 
     // Loop over atoms in the selection using an iterator
-    const int          maxnovdw = 10;
-    ConstArrayRef<int> atomind  = sel_.atomIndices();
-    for (ConstArrayRef<int>::iterator ai = atomind.begin(); (ai < atomind.end()); ++ai)
+    const int           maxnovdw = 10;
+    ArrayRef<const int> atomind  = sel_.atomIndices();
+    for (ArrayRef<const int>::iterator ai = atomind.begin(); (ai < atomind.end()); ++ai)
     {
         // Dereference the iterator to obtain an atom number
         int  i = *ai;
index de7116cac63dec5fc9d68f1b1bb04e520748843c..1b655851f66d22ef24a9572b217a14afbeb5bdfe 100644 (file)
@@ -559,10 +559,10 @@ Sasa::initAnalysis(const TrajectoryAnalysisSettings &settings,
 
     // TODO: Not exception-safe, but nice solution would be to have a C++
     // atom properties class...
-    gmx_atomprop_t     aps = gmx_atomprop_init();
+    gmx_atomprop_t      aps = gmx_atomprop_init();
 
-    ConstArrayRef<int> atomIndices = surfaceSel_.atomIndices();
-    int                ndefault    = 0;
+    ArrayRef<const int> atomIndices = surfaceSel_.atomIndices();
+    int                 ndefault    = 0;
     for (int i = 0; i < surfaceSel_.posCount(); i++)
     {
         const int ii     = atomIndices[i];
@@ -597,7 +597,7 @@ Sasa::initAnalysis(const TrajectoryAnalysisSettings &settings,
     // and store it in the selection ID map for easy lookup.
     for (size_t g = 0; g < outputSel_.size(); ++g)
     {
-        ConstArrayRef<int> outputIndices = outputSel_[g].atomIndices();
+        ArrayRef<const int> outputIndices = outputSel_[g].atomIndices();
         for (int i = 0, j = 0; i < outputSel_[g].posCount(); ++i)
         {
             while (j < surfaceSel_.posCount() && outputIndices[i] > atomIndices[j])
index 3137b8ddac0219c91dbc26491456fe1b84ed5ebf..6594a4a1aa89b469aa3c92c4b041d837cd46ba75 100644 (file)
@@ -700,9 +700,9 @@ Select::writeOutput()
         {
             for (int i = 0; i < sel_[g].posCount(); ++i)
             {
-                ConstArrayRef<int>                 atomIndices
+                ArrayRef<const int>                 atomIndices
                     = sel_[g].position(i).atomIndices();
-                ConstArrayRef<int>::const_iterator ai;
+                ArrayRef<const int>::const_iterator ai;
                 for (ai = atomIndices.begin(); ai != atomIndices.end(); ++ai)
                 {
                     pdbinfo[*ai].occup += occupancyModule_->average(g, i);
@@ -732,7 +732,7 @@ Select::writeOutput()
                 std::set<int> atomIndicesSet;
                 for (size_t g = 0; g < sel_.size(); ++g)
                 {
-                    ConstArrayRef<int> atomIndices = sel_[g].atomIndices();
+                    ArrayRef<const int> atomIndices = sel_[g].atomIndices();
                     atomIndicesSet.insert(atomIndices.begin(), atomIndices.end());
                 }
                 std::vector<int>  allAtomIndices(atomIndicesSet.begin(),
index a3801082683f686731cadd8dcdf34aa491461aa8..f479ef3e5f0c68d4301023d41f820a9029cb3e65 100644 (file)
@@ -552,7 +552,7 @@ static std::vector<real> make_unsp(int densit, int cubus)
 }
 
 static void
-nsc_dclm_pbc(const rvec *coords, const ConstArrayRef<real> &radius, int nat,
+nsc_dclm_pbc(const rvec *coords, const ArrayRef<const real> &radius, int nat,
              const real *xus, int n_dot, int mode,
              real *value_of_area, real **at_area,
              real *value_of_vol,
@@ -734,7 +734,7 @@ class SurfaceAreaCalculator::Impl
         }
 
         std::vector<real>             unitSphereDots_;
-        ConstArrayRef<real>           radius_;
+        ArrayRef<const real>          radius_;
         int                           flags_;
         mutable AnalysisNeighborhood  nb_;
 };
@@ -753,7 +753,7 @@ void SurfaceAreaCalculator::setDotCount(int dotCount)
     impl_->unitSphereDots_ = make_unsp(dotCount, 4);
 }
 
-void SurfaceAreaCalculator::setRadii(const ConstArrayRef<real> &radius)
+void SurfaceAreaCalculator::setRadii(const ArrayRef<const real> &radius)
 {
     impl_->radius_ = radius;
     if (!radius.empty())
index 4a530d5dd8e718f07b1481fd6a9c226968b49840..09a0a8269c0f3aad9ab33eab436aa243b7d49ce1 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -104,7 +104,7 @@ class SurfaceAreaCalculator
          *
          * Does not throw.
          */
-        void setRadii(const ConstArrayRef<real> &radius);
+        void setRadii(const ArrayRef<const real> &radius);
 
         /*! \brief
          * Requests calculation of volume.
index ac52981c0847df237d33a9f18001e66aebce1506..afec611849771ea82be067e7e1728d1ae9fc7120 100644 (file)
@@ -191,7 +191,7 @@ class MappedUnionFinder
          * If multiple indices are the same, then these items are considered
          * equivalent.
          */
-        void initWithGroupIndices(ConstArrayRef<int> indices)
+        void initWithGroupIndices(ArrayRef<const int> indices)
         {
             mapping_.clear();
             int groupCount = 0;
index 0e945c2bb0c643f369ceed69c400df70eeb7733d..0812235611572b35479434d8400f58820f308af1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -137,7 +137,7 @@ SelectionTester::analyzeFrame(int /*frnr*/, const t_trxframe & /*fr*/, t_pbc * /
         {
             n = nmaxind_;
         }
-        ConstArrayRef<int> atoms = sel.atomIndices();
+        ArrayRef<const int> atoms = sel.atomIndices();
         for (int i = 0; i < n; ++i)
         {
             fprintf(stderr, " %d", atoms[i]+1);
index b82c057ac482a30ad4f98de6dec15a599f212e9c..a411e1903b2e96b48c8041b258b7e6554a30e372 100644 (file)
@@ -352,13 +352,6 @@ class ArrayRef
         pointer           end_;
 };
 
-
-//! Alias for ArrayRef<const T>
-//! \related ArrayRef
-template <typename T>
-using ConstArrayRef = ArrayRef<const T>;
-
-
 //! \copydoc ArrayRef::fromPointers()
 //! \related ArrayRef
 template <typename T>
@@ -386,24 +379,24 @@ ArrayRef<T> arrayRefFromVector(typename std::vector<T>::iterator begin,
 //! \copydoc ArrayRef::fromPointers()
 //! \related ArrayRef
 template <typename T>
-ConstArrayRef<T> constArrayRefFromPointers(const T *begin, const T *end)
+ArrayRef<const T> constArrayRefFromPointers(const T *begin, const T *end)
 {
-    return ConstArrayRef<T>::fromPointers(begin, end);
+    return ArrayRef<const T>::fromPointers(begin, end);
 }
 //! \copydoc ArrayRef::fromArray()
 //! \related ArrayRef
 template <typename T>
-ConstArrayRef<T> constArrayRefFromArray(const T *begin, size_t size)
+ArrayRef<const T> constArrayRefFromArray(const T *begin, size_t size)
 {
-    return ConstArrayRef<T>::fromArray(begin, size);
+    return ArrayRef<const T>::fromArray(begin, size);
 }
 //! \copydoc ArrayRef::fromVector()
 //! \related ArrayRef
 template <typename T>
-ConstArrayRef<T> constArrayRefFromVector(typename std::vector<T>::const_iterator begin,
-                                         typename std::vector<T>::const_iterator end)
+ArrayRef<const T> constArrayRefFromVector(typename std::vector<T>::const_iterator begin,
+                                          typename std::vector<T>::const_iterator end)
 {
-    return ConstArrayRef<T>::fromVector(begin, end);
+    return ArrayRef<const T>::fromVector(begin, end);
 }
 
 /*! \brief
index 8b313b40568a5137fa782b50a4288a278f39f423..4a0030947e2158697344d09a9cc30bf403fb6d95 100644 (file)
@@ -74,7 +74,7 @@ bool beCool(void)
 
 //! Return a valid random index into \c arrayRef
 template <typename T>
-const T &getRandomElement(gmx::ConstArrayRef<T> arrayRef)
+const T &getRandomElement(gmx::ArrayRef<const T> arrayRef)
 {
     std::random_device                    generator;
     std::uniform_int_distribution<size_t> distribution(0, arrayRef.size()-1);
index 47b9e257eb72d9e6d9e3507eebe15458b4b21266..71302482567e614d11a4de55f17cf49f6dc0edb0 100644 (file)
@@ -66,8 +66,8 @@ TEST(EmptyArrayRefTest, IsEmpty)
 
 TEST(EmptyConstArrayRefTest, IsEmpty)
 {
-    EmptyArrayRef       emptyArray = {};
-    ConstArrayRef<real> empty(emptyArray);
+    EmptyArrayRef        emptyArray = {};
+    ArrayRef<const real> empty(emptyArray);
 
     EXPECT_EQ(0U, empty.size());
     EXPECT_TRUE(empty.empty());
@@ -87,16 +87,16 @@ typedef ::testing::Types<
         ArrayRef<gmx_uint64_t>,
         ArrayRef<float>,
         ArrayRef<double>,
-        ConstArrayRef<char>,
-        ConstArrayRef<unsigned char>,
-        ConstArrayRef<int>,
-        ConstArrayRef<unsigned int>,
-        ConstArrayRef<long>,
-        ConstArrayRef<unsigned long>,
-        ConstArrayRef<gmx_int64_t>,
-        ConstArrayRef<gmx_uint64_t>,
-        ConstArrayRef<float>,
-        ConstArrayRef<double>
+        ArrayRef<const char>,
+        ArrayRef<const unsigned char>,
+        ArrayRef<const int>,
+        ArrayRef<const unsigned int>,
+        ArrayRef<const long>,
+        ArrayRef<const unsigned long>,
+        ArrayRef<const gmx_int64_t>,
+        ArrayRef<const gmx_uint64_t>,
+        ArrayRef<const float>,
+        ArrayRef<const double>
         > ArrayRefTypes;
 
 /*! \brief Permit all the tests to run on all kinds of ArrayRefs
index 675e9802866f4809531df82d6cbecc7a37b21d2f..1608f1909aec0818c27836da14ecc1525b0448d0 100644 (file)
@@ -198,11 +198,11 @@ TEST(formatAndJoinTest, Works)
 {
     const char * const words[] = { "The", "quick", "brown", "fox" };
     EXPECT_EQ("The       .quick     .brown     .fox       ",
-              gmx::formatAndJoin(gmx::ConstArrayRef<const char *>(words), ".",
+              gmx::formatAndJoin(gmx::ArrayRef<const char *const>(words), ".",
                                  gmx::StringFormatter("%-10s")));
 
     const int values[] = { 0, 1, 4 };
-    EXPECT_EQ("0,1,4", gmx::formatAndJoin(gmx::ConstArrayRef<int>(values), ",",
+    EXPECT_EQ("0,1,4", gmx::formatAndJoin(gmx::ArrayRef<const int>(values), ",",
                                           gmx::StringFormatter("%d")));
 }
 
@@ -213,7 +213,7 @@ TEST(formatAndJoinTest, Works)
 TEST(JoinStringsTest, Works)
 {
     const char * const               words[] = { "The", "quick", "brown", "fox" };
-    gmx::ConstArrayRef<const char *> refToWords(words);
+    gmx::ArrayRef<const char *const> refToWords(words);
     EXPECT_EQ("The; quick; brown; fox", gmx::joinStrings(refToWords.begin(), refToWords.end(), "; "));
     EXPECT_EQ("The-quick-brown-fox", gmx::joinStrings(refToWords, "-"));
     EXPECT_EQ("The-quick-brown-fox", gmx::joinStrings(words, "-"));
index 5d2ec6e5f57f9aa715fc0b7a69ddcd4d4e263cb3..5317d95b528505edf25368c722bc8ce9be3b09d4 100644 (file)
@@ -121,7 +121,7 @@ CommandLine::CommandLine()
 {
 }
 
-CommandLine::CommandLine(const ConstArrayRef<const char *> &cmdline)
+CommandLine::CommandLine(const ArrayRef<const char *const> &cmdline)
     : impl_(new Impl(cmdline.data(), cmdline.size()))
 {
 }
@@ -135,7 +135,7 @@ CommandLine::~CommandLine()
 {
 }
 
-void CommandLine::initFromArray(const ConstArrayRef<const char *> &cmdline)
+void CommandLine::initFromArray(const ArrayRef<const char *const> &cmdline)
 {
     impl_.reset(new Impl(cmdline.data(), cmdline.size()));
 }
@@ -322,13 +322,13 @@ void CommandLineTestHelper::setInputFileContents(
 
 void CommandLineTestHelper::setInputFileContents(
         CommandLine *args, const char *option, const char *extension,
-        const ConstArrayRef<const char *> &contents)
+        const ArrayRef<const char *const> &contents)
 {
     GMX_ASSERT(extension[0] != '.', "Extension should not contain a dot");
     std::string fullFilename = impl_->fileManager_.getTemporaryFilePath(
                 formatString("%d.%s", args->argc(), extension));
     TextWriter  file(fullFilename);
-    ConstArrayRef<const char *>::const_iterator i;
+    ArrayRef<const char *const>::const_iterator i;
     for (i = contents.begin(); i != contents.end(); ++i)
     {
         file.writeLine(*i);
@@ -420,7 +420,7 @@ void CommandLineTestBase::setInputFileContents(
 
 void CommandLineTestBase::setInputFileContents(
         const char *option, const char *extension,
-        const ConstArrayRef<const char *> &contents)
+        const ArrayRef<const char *const> &contents)
 {
     impl_->helper_.setInputFileContents(&impl_->cmdline_, option, extension,
                                         contents);
index 1f2365b59ba3b547cdafcb1e8fa8b1bd8527a072..fc3fd4afaf0fb6f42214a4fcd8049604b066d1ea 100644 (file)
@@ -111,7 +111,7 @@ class CommandLine
          * This constructor is not explicit to make it possible to create a
          * CommandLine object directly from a C array.
          */
-        CommandLine(const ConstArrayRef<const char *> &cmdline);
+        CommandLine(const ArrayRef<const char *const> &cmdline);
         //! Creates a deep copy of a command-line object.
         CommandLine(const CommandLine &other);
         ~CommandLine();
@@ -129,7 +129,7 @@ class CommandLine
          *
          * Strong exception safety.
          */
-        void initFromArray(const ConstArrayRef<const char *> &cmdline);
+        void initFromArray(const ArrayRef<const char *const> &cmdline);
 
         /*! \brief
          * Appends an argument to the command line.
@@ -295,7 +295,7 @@ class CommandLineTestHelper
          */
         void setInputFileContents(CommandLine *args, const char *option,
                                   const char *extension,
-                                  const ConstArrayRef<const char *> &contents);
+                                  const ArrayRef<const char *const> &contents);
         /*! \brief
          * Sets an output file parameter and adds it to the set of tested files.
          *
@@ -399,7 +399,7 @@ class CommandLineTestBase : public ::testing::Test
          */
         void setInputFileContents(const char                        *option,
                                   const char                        *extension,
-                                  const ConstArrayRef<const char *> &contents);
+                                  const ArrayRef<const char *const> &contents);
         /*! \brief
          * Sets an output file parameter and adds it to the set of tested files.
          *
index da76c52d454f96125bff7d5bf5c9edfd6338abe1..9b1380f49c33516843e3aaca1f0294992bfb0ab0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -132,7 +132,7 @@ class InteractiveTestHelper::Impl
         }
 
         TestReferenceChecker             checker_;
-        ConstArrayRef<const char *>      inputLines_;
+        ArrayRef<const char *const>      inputLines_;
         bool                             bLastNewline_;
         size_t                           currentLine_;
         bool                             bHasOutput_;
@@ -156,7 +156,7 @@ void InteractiveTestHelper::setLastNewline(bool bInclude)
 }
 
 void InteractiveTestHelper::setInputLines(
-        const ConstArrayRef<const char *> &inputLines)
+        const ArrayRef<const char *const> &inputLines)
 {
     impl_->inputLines_  = inputLines;
     impl_->currentLine_ = 0;
index 66167f1d603c07b5daf7808caf71c1f0a25e5bbc..11d96862cda56b13eb2370e362a4f56fa861fcff 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -98,7 +98,7 @@ class InteractiveTestHelper
          * If there are more `readLine()` calls than there are input lines,
          * the remaining calls return end-of-input.
          */
-        void setInputLines(const ConstArrayRef<const char *> &inputLines);
+        void setInputLines(const ArrayRef<const char *const> &inputLines);
 
         //! Returns the input stream for the session.
         TextInputStream  &inputStream();