Make it more aligned with std::span.
Almost everywhere it wasn't needed anyhow.
Only exception: ternary conditional operator. But there the type
was already explict in all but one case and that one case
(src/gromacs/domdec/distribute.cpp) was confusing because of
multiple implicit conversions.
Related #2859
Change-Id: I0b61abdc2e60285a7ca17e3bdc7e53cb72c5cf6a
matrix boxDummy = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };
gmx_enerdata_t enerdDummy;
- gmx::ForceProviderInput forceProviderInput(gmx::EmptyArrayRef {}, md, 0.0, boxDummy, *cr);
+ gmx::ForceProviderInput forceProviderInput({}, md, 0.0, boxDummy, *cr);
gmx::ForceProviderOutput forceProviderOutput(&forceWithVirial, &enerdDummy);
forceProviders.calculateForces(forceProviderInput, &forceProviderOutput);
done_commrec(cr);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
GMX_RELEASE_ASSERT(false, "opt2fns should be called with a valid option");
- return gmx::EmptyArrayRef();
+ return {};
}
gmx::ArrayRef<const std::string>
}
else
{
- return gmx::EmptyArrayRef();
+ return {};
}
}
GMX_RELEASE_ASSERT(false, "ftp2fns should be called with a valid option");
- return gmx::EmptyArrayRef();
+ return {};
}
gmx_bool ftp2bSet(int ftp, int nfile, const t_filenm fnm[])
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
const char *const cmdline[] = {
"test", "-i1", "2", "-i2", "-3"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_EQ( 2, value1);
EXPECT_EQ(-3, value2);
EXPECT_EQ( 3, value3);
const char *const cmdline[] = {
"test", "-i1", "2", "-i2", "-3"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_EQ( 2, value1);
EXPECT_EQ(-3, value2);
EXPECT_EQ( 3, value3);
const char *const cmdline[] = {
"test", "-r1", "2", "-r2", "-.5"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_EQ( 2.0, value1);
EXPECT_EQ(-0.5, value2);
EXPECT_EQ( 2.5, value3);
const char *const cmdline[] = {
"test", "-s1", "", "-s2", "test"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_STREQ("", value1);
EXPECT_STREQ("test", value2);
EXPECT_STREQ("default", value3);
const char *const cmdline[] = {
"test", "-nob1", "-b2"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_FALSE(value1);
EXPECT_TRUE(value2);
EXPECT_TRUE(value3);
const char *const cmdline[] = {
"test", "-v1", "2", "1", "3", "-v2", "1"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_EQ(2.0, value1[XX]);
EXPECT_EQ(1.0, value1[YY]);
EXPECT_EQ(3.0, value1[ZZ]);
const char *const cmdline[] = {
"test", "-t1", "2", "-t2", "-.5"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_EQ( 2.0, value1);
EXPECT_EQ(-0.5, value2);
EXPECT_EQ( 2.5, value3);
const char *const cmdline[] = {
"test", "-t1", "2", "-t2", "-.5", "-tu", "ns"
};
- parseFromArray(cmdline, PCA_TIME_UNIT, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, PCA_TIME_UNIT, {}, pa);
EXPECT_EQ( 2000.0, value1);
EXPECT_EQ(-500.0, value2);
EXPECT_EQ( 2.5, value3);
const char *const cmdline[] = {
"test", "-s1", "off", "-s2", "val"
};
- parseFromArray(cmdline, 0, gmx::EmptyArrayRef(), pa);
+ parseFromArray(cmdline, 0, {}, pa);
EXPECT_STREQ("off", value1[0]);
EXPECT_STREQ("value", value2[0]);
EXPECT_STREQ("default", value3[0]);
const char *const cmdline[] = {
"test", "-o1", "-o2", "test", "-om", "test1", "test2.xvg", "-om2"
};
- parseFromArray(cmdline, 0, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, 0, fnm, {});
EXPECT_STREQ("out1.xvg", opt2fn_null("-o1", nfile(), fnm));
EXPECT_STREQ("test.xvg", opt2fn_null("-o2", nfile(), fnm));
gmx::ArrayRef<const std::string> files = opt2fns("-om", nfile(), fnm);
const char *const cmdline[] = {
"test"
};
- parseFromArray(cmdline, 0, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, 0, fnm, {});
EXPECT_STREQ("topol.tpr", ftp2fn(efTPS, nfile(), fnm));
EXPECT_STREQ("traj.xtc", opt2fn("-f2", nfile(), fnm));
EXPECT_EQ(nullptr, opt2fn_null("-f2", nfile(), fnm));
const char *const cmdline[] = {
"test", "-deffnm", "def", "-f2", "other", "-o"
};
- parseFromArray(cmdline, PCA_CAN_SET_DEFFNM, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, PCA_CAN_SET_DEFFNM, fnm, {});
EXPECT_STREQ("def.tpr", ftp2fn(efTPS, nfile(), fnm));
EXPECT_STREQ("other.xtc", opt2fn("-f2", nfile(), fnm));
EXPECT_STREQ("def.xtc", opt2fn("-f3", nfile(), fnm));
const char *const cmdline[] = {
"test", "-o2", "-o3", "test"
};
- parseFromArray(cmdline, PCA_CAN_SET_DEFFNM, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, PCA_CAN_SET_DEFFNM, fnm, {});
EXPECT_STREQ("conf1.gro", opt2fn("-o1", nfile(), fnm));
EXPECT_STREQ("conf2.pdb", opt2fn("-o2", nfile(), fnm));
EXPECT_STREQ("test.gro", opt2fn("-o3", nfile(), fnm));
const char *const cmdline[] = {
"test", "-f2", "-f3", "other", "-f4", "trj.gro", "-g2", "foo"
};
- parseFromArray(cmdline, PCA_DISABLE_INPUT_FILE_CHECKING, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, PCA_DISABLE_INPUT_FILE_CHECKING, fnm, {});
EXPECT_STREQ("topol.tpr", ftp2fn(efTPS, nfile(), fnm));
EXPECT_STREQ("trj.xtc", opt2fn("-f", nfile(), fnm));
EXPECT_STREQ("trj2.xtc", opt2fn("-f2", nfile(), fnm));
const char *const cmdline[] = {
"test"
};
- parseFromArray(cmdline, 0, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, 0, fnm, {});
EXPECT_STREQ("topol.tpr", ftp2fn(efTPS, nfile(), fnm));
EXPECT_STREQ("trj.xtc", opt2fn("-f", nfile(), fnm));
}
const char *const cmdline[] = {
"test", "-c2", "-c3", "nonexistent", "-c4", "nonexistent.cpt", "-f", "nonexistent"
};
- parseFromArray(cmdline, 0, fnm, gmx::EmptyArrayRef());
+ parseFromArray(cmdline, 0, fnm, {});
EXPECT_STREQ("file1.cpt", opt2fn("-c", nfile(), fnm));
EXPECT_STREQ("file2.cpt", opt2fn("-c2", nfile(), fnm));
EXPECT_STREQ("nonexistent.cpt", opt2fn("-c3", nfile(), fnm));
std::string expectedG = addFileArg("-g", ".gro.Z", efFull);
expectedF = gmx::Path::stripExtension(expectedF);
expectedG = gmx::Path::stripExtension(expectedG);
- parseFromArgs(0, fnm, gmx::EmptyArrayRef());
+ parseFromArgs(0, fnm, {});
EXPECT_EQ(expectedF, opt2fn("-f", nfile(), fnm));
EXPECT_EQ(expectedG, opt2fn("-g", nfile(), fnm));
}
};
args_.append("test");
std::string expected = addFileArg("-f", ".foo", efFull);
- parseFromArgs(0, fnm, gmx::EmptyArrayRef());
+ parseFromArgs(0, fnm, {});
EXPECT_EQ(expected, opt2fn("-f", nfile(), fnm));
}
{ efTRX, "-f3", nullptr, ffREAD },
{ efTRX, "-f4", def4.c_str(), ffREAD }
};
- parseFromArgs(0, fnm, gmx::EmptyArrayRef());
+ parseFromArgs(0, fnm, {});
EXPECT_EQ(expected1, opt2fn("-f1", nfile(), fnm));
EXPECT_EQ(expected2, opt2fn("-f2", nfile(), fnm));
EXPECT_EQ(expected3, opt2fn("-f3", nfile(), fnm));
std::string deffnm = gmx::Path::stripExtension(expected3);
args_.append("-deffnm");
args_.append(deffnm);
- parseFromArgs(PCA_CAN_SET_DEFFNM, fnm, gmx::EmptyArrayRef());
+ parseFromArgs(PCA_CAN_SET_DEFFNM, fnm, {});
EXPECT_EQ(expected1, opt2fn("-f1", nfile(), fnm));
EXPECT_EQ(expected2, opt2fn("-f2", nfile(), fnm));
EXPECT_EQ(expected3, opt2fn("-f3", nfile(), fnm));
}
if (state_local->flags & (1 << estX))
{
- gmx::ArrayRef<gmx::RVec> globalXRef = state ? makeArrayRef(state->x) : gmx::EmptyArrayRef();
- dd_collect_vec(dd, state_local, makeConstArrayRef(state_local->x), globalXRef);
+ auto globalXRef = state ? state->x : gmx::ArrayRef<gmx::RVec>();
+ dd_collect_vec(dd, state_local, state_local->x, globalXRef);
}
if (state_local->flags & (1 << estV))
{
- gmx::ArrayRef<gmx::RVec> globalVRef = state ? makeArrayRef(state->v) : gmx::EmptyArrayRef();
- dd_collect_vec(dd, state_local, makeConstArrayRef(state_local->v), globalVRef);
+ auto globalVRef = state ? state->v : gmx::ArrayRef<gmx::RVec>();
+ dd_collect_vec(dd, state_local, state_local->v, globalVRef);
}
if (state_local->flags & (1 << estCGP))
{
- gmx::ArrayRef<gmx::RVec> globalCgpRef = state ? makeArrayRef(state->cg_p) : gmx::EmptyArrayRef();
- dd_collect_vec(dd, state_local, makeConstArrayRef(state_local->cg_p), globalCgpRef);
+ auto globalCgpRef = state ? state->cg_p : gmx::ArrayRef<gmx::RVec>();
+ dd_collect_vec(dd, state_local, state_local->cg_p, globalCgpRef);
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
if (state_local->flags & (1 << estX))
{
- distributeVec(dd, DDMASTER(dd) ? makeArrayRef(state->x) : gmx::EmptyArrayRef(), state_local->x);
+ distributeVec(dd, DDMASTER(dd) ? state->x : gmx::ArrayRef<const gmx::RVec>(), state_local->x);
}
if (state_local->flags & (1 << estV))
{
- distributeVec(dd, DDMASTER(dd) ? makeArrayRef(state->v) : gmx::EmptyArrayRef(), state_local->v);
+ distributeVec(dd, DDMASTER(dd) ? state->v : gmx::ArrayRef<const gmx::RVec>(), state_local->v);
}
if (state_local->flags & (1 << estCGP))
{
- distributeVec(dd, DDMASTER(dd) ? makeArrayRef(state->cg_p) : gmx::EmptyArrayRef(), state_local->cg_p);
+ distributeVec(dd, DDMASTER(dd) ? state->cg_p : gmx::ArrayRef<const gmx::RVec>(), state_local->cg_p);
}
}
}
else
{
- return gmx::EmptyArrayRef();
+ return {};
}
}
else
{
// Currently unreachable
- at2con_mt = gmx::EmptyArrayRef();
+ at2con_mt = {};
ireq = nullptr;
}
low_make_reverse_ilist(ilist, atoms->atom, vsitePbc,
count,
bConstr, bSettle, bBCheck,
- gmx::EmptyArrayRef(), gmx::EmptyArrayRef(),
+ {}, {},
bLinkToAllAtoms, FALSE);
ril_mt->index.push_back(0);
*nint +=
make_reverse_ilist(*mtop->intermolecular_ilist,
&atoms_global,
- gmx::EmptyArrayRef(),
+ {},
rt.bConstr, rt.bSettle, rt.bBCheck, FALSE,
&rt.ril_intermol);
}
make_reverse_ilist(*mtop->intermolecular_ilist,
&atoms,
- gmx::EmptyArrayRef(),
+ {},
FALSE, FALSE, FALSE, TRUE, &ril_intermol);
}
* The constraints are discarded here.
*/
reverse_ilist_t ril;
- make_reverse_ilist(molt.ilist, &molt.atoms, gmx::EmptyArrayRef(),
+ make_reverse_ilist(molt.ilist, &molt.atoms, {},
FALSE, FALSE, FALSE, TRUE, &ril);
cgi_mb = &cginfo_mb[mb];
// from mdatoms for the other call to gmx_pme_do), so we have
// fewer lines of code and less parameter passing.
const int pmeFlags = GMX_PME_DO_ALL_F | (bEnerVir ? GMX_PME_CALC_ENER_VIR : 0);
- PmeOutput output = {gmx::EmptyArrayRef {}, 0, {{0}}, 0, {{0}}};
+ PmeOutput output = {{}, 0, {{0}}, 0, {{0}}};
if (useGpuForPme)
{
const bool boxChanged = false;
else
{
trxout = trjtools_gmx_prepare_tng_writing(out_file, 'w', nullptr,
- inFilesEdited[0].c_str(), -1, nullptr, gmx::EmptyArrayRef(), nullptr);
+ inFilesEdited[0].c_str(), -1, nullptr, {}, nullptr);
}
}
else
init_nnb(&nnb, atoms->nr, 4);
gen_nnb(&nnb, plist);
print_nnb(&nnb, "NNB");
- gen_pad(&nnb, atoms, &rtp_header_settings, plist, excls, gmx::EmptyArrayRef(), TRUE);
+ gen_pad(&nnb, atoms, &rtp_header_settings, plist, excls, {}, TRUE);
done_nnb(&nnb);
if (!bPairs)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
*/
ArrayRefWithPadding()
: begin_(nullptr), end_(nullptr), paddedEnd_(nullptr) {}
- /*! \brief
- * Constructs an empty reference.
- *
- * This is provided for convenience, such that EmptyArrayRef can be
- * used to initialize any ArrayRefWithPadding, without specifying the template
- * type. It is not explicit to enable that usage.
- */
- ArrayRefWithPadding(const EmptyArrayRef & /*unused*/)
- : begin_(nullptr), end_(nullptr), paddedEnd_(nullptr) {}
/*! \brief
* Constructs a reference to a particular range.
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
TEST(EmptyArrayRefWithPaddingTest, IsEmpty)
{
- EmptyArrayRef emptyArray = {};
- ArrayRefWithPadding<real> empty(emptyArray);
+ ArrayRefWithPadding<real> empty;
EXPECT_EQ(0U, empty.size());
EXPECT_TRUE(empty.empty());
TEST(EmptyConstArrayRefWithPaddingTest, IsEmpty)
{
- EmptyArrayRef emptyArray = {};
- ArrayRefWithPadding<const real> empty(emptyArray);
+ ArrayRefWithPadding<const real> empty;
EXPECT_EQ(0U, empty.size());
EXPECT_TRUE(empty.empty());
}
else
{
- return EmptyArrayRef();
+ return {};
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
{
if (mdof_flags & (MDOF_X | MDOF_X_COMPRESSED))
{
- gmx::ArrayRef<gmx::RVec> globalXRef = MASTER(cr) ? makeArrayRef(state_global->x) : gmx::EmptyArrayRef();
- dd_collect_vec(cr->dd, state_local, makeArrayRef(state_local->x), globalXRef);
+ auto globalXRef = MASTER(cr) ? state_global->x : gmx::ArrayRef<gmx::RVec>();
+ dd_collect_vec(cr->dd, state_local, state_local->x, globalXRef);
}
if (mdof_flags & MDOF_V)
{
- gmx::ArrayRef<gmx::RVec> globalVRef = MASTER(cr) ? makeArrayRef(state_global->v) : gmx::EmptyArrayRef();
- dd_collect_vec(cr->dd, state_local, makeArrayRef(state_local->v), globalVRef);
+ auto globalVRef = MASTER(cr) ? state_global->v : gmx::ArrayRef<gmx::RVec>();
+ dd_collect_vec(cr->dd, state_local, state_local->v, globalVRef);
}
}
f_global = of->f_global;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
}
else
{
- return gmx::EmptyArrayRef();
+ return {};
}
}
/* If bX=true, x was collected to state_global in the call above */
if (!bX)
{
- gmx::ArrayRef<gmx::RVec> globalXRef = MASTER(cr) ? makeArrayRef(state_global->x) : gmx::EmptyArrayRef();
- dd_collect_vec(cr->dd, &state->s, makeArrayRef(state->s.x), globalXRef);
+ auto globalXRef = MASTER(cr) ? state_global->x : gmx::ArrayRef<gmx::RVec>();
+ dd_collect_vec(cr->dd, &state->s, state->s.x, globalXRef);
}
}
else
}
else
{
- return gmx::EmptyArrayRef();
+ return {};
}
};
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
const NeighborhoodSearchTestData &data)
{
testPairSearchFull(search, data, data.testPositions(), nullptr,
- gmx::EmptyArrayRef(), gmx::EmptyArrayRef(), false);
+ {}, {}, false);
}
void NeighborhoodSearchTest::testPairSearchIndexed(
ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
testPairSearchFull(&search, data, data.testPositions(), nullptr,
- gmx::EmptyArrayRef(), gmx::EmptyArrayRef(), true);
+ {}, {}, true);
}
TEST_F(NeighborhoodSearchTest, GridSelfPairsSearch)
ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
testPairSearchFull(&search, data, data.testPositions(), nullptr,
- gmx::EmptyArrayRef(), gmx::EmptyArrayRef(), true);
+ {}, {}, true);
}
TEST_F(NeighborhoodSearchTest, HandlesConcurrentSearches)
testPairSearchFull(&search, data,
data.testPositions().exclusionIds(helper.testPosIds()),
- helper.exclusions(), gmx::EmptyArrayRef(),
- gmx::EmptyArrayRef(), false);
+ helper.exclusions(), {},
+ {}, false);
}
TEST_F(NeighborhoodSearchTest, GridSearchExclusions)
testPairSearchFull(&search, data,
data.testPositions().exclusionIds(helper.testPosIds()),
- helper.exclusions(), gmx::EmptyArrayRef(),
- gmx::EmptyArrayRef(), false);
+ helper.exclusions(), {},
+ {}, false);
}
} // namespace
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
void testSingleStatic(e_poscalc_t type, int flags, bool bExpectTop,
const gmx::ArrayRef<const int> &atoms,
- const gmx::ArrayRef<const int> &index = gmx::EmptyArrayRef());
+ const gmx::ArrayRef<const int> &index = {});
void testSingleDynamic(e_poscalc_t type, int flags, bool bExpectTop,
const gmx::ArrayRef<const int> &initAtoms,
const gmx::ArrayRef<const int> &evalAtoms,
- const gmx::ArrayRef<const int> &index = gmx::EmptyArrayRef());
+ const gmx::ArrayRef<const int> &index = {});
gmx::test::TestReferenceData data_;
gmx::test::TestReferenceChecker checker_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019, 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.
GMX_ASSERT((reinterpret_cast<size_type>(end)/sizeof(*end))%simdWidth == 0,
"Size of ArrayRef needs to be divisible by type size");
}
- //! \copydoc ArrayRef::ArrayRef(const EmptyArrayRef&)
- SimdArrayRef(const EmptyArrayRef & /*unused*/) : begin_(nullptr), end_(nullptr) {}
//! \copydoc ArrayRef::ArrayRef(U)
template<typename U,
typename = typename std::enable_if<
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2019, 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.
TEST(EmptyArrayRefTest, IsEmpty)
{
- EmptyArrayRef emptyArray = {};
- ArrayRef<SimdReal> empty(emptyArray);
+ ArrayRef<SimdReal> empty = ArrayRef<real>();
EXPECT_EQ(0U, empty.size());
EXPECT_TRUE(empty.empty());
}
else
{
- return EmptyArrayRef();
+ return {};
}
}
}
else
{
- return EmptyArrayRef();
+ return {};
}
}
namespace gmx
{
-/*! \brief
- * Tag type to initialize empty array references.
- *
- * This type (together with appropriate constructors in ArrayRef)
- * allows initializing any array reference to an empty value
- * without explicitly specifying its type. This is convenient when calling
- * a function that takes an array reference, where constructing an empty
- * reference explicitly would otherwise require specifying the full array
- * reference type, including the template parameter.
- */
-struct EmptyArrayRef {};
-
/*! \brief STL-like interface to a C array of T (or part
* of a std container of T).
*
* Constructs an empty reference.
*/
ArrayRef() : begin_(nullptr), end_(nullptr) {}
- /*! \brief
- * Constructs an empty reference.
- *
- * This is provided for convenience, such that EmptyArrayRef can be
- * used to initialize any ArrayRef, without specifying the template
- * type. It is not explicit to enable that usage.
- */
- ArrayRef(const EmptyArrayRef & /*unused*/) : begin_(nullptr), end_(nullptr) {}
/*! \brief
* Constructs a reference to a container or reference
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019, 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.
TEST(EmptyArrayRefTest, IsEmpty)
{
- EmptyArrayRef emptyArray = {};
- ArrayRef<real> empty(emptyArray);
+ ArrayRef<real> empty;
EXPECT_EQ(0U, empty.size());
EXPECT_TRUE(empty.empty());
TEST(EmptyConstArrayRefTest, IsEmpty)
{
- EmptyArrayRef emptyArray = {};
- ArrayRef<const real> empty(emptyArray);
+ ArrayRef<const real> empty;
EXPECT_EQ(0U, empty.size());
EXPECT_TRUE(empty.empty());