replace std integral_constant by corresponding typedef CSizeT

This commit is contained in:
Christian Zimmermann 2023-01-04 23:11:51 +01:00
parent b74ace2f43
commit 603d03971d
8 changed files with 39 additions and 39 deletions

View file

@ -11,10 +11,10 @@ namespace CNORXZ
constexpr decltype(auto) iteri(const G& g, const F& f, Isq<Is...> is)
{
if constexpr(std::is_same<F,NoF>::value){
( g(std::integral_constant<SizeT,Is>{}), ... );
( g(CSizeT<Is>{}), ... );
}
else {
return f( g(std::integral_constant<SizeT,Is>{}) ... );
return f( g(CSizeT<Is>{}) ... );
}
}
@ -36,8 +36,8 @@ namespace CNORXZ
}
}
else {
if constexpr(c(std::integral_constant<SizeT,I>{})){
return iterIfi<E,I+1>(g, f, c, args..., g(std::integral_constant<SizeT,I>{}));
if constexpr(c(CSizeT<I>{})){
return iterIfi<E,I+1>(g, f, c, args..., g(CSizeT<I>{}));
}
else {
return iterIfi<E,I+1>(g, f, c, args...);

View file

@ -32,19 +32,19 @@ namespace CNORXZ
template <SizeT N>
constexpr decltype(auto) MFormat<N>::size() const
{
return std::integral_constant<SizeT,N>{};
return CSizeT<N>{};
}
template <SizeT N>
template <SizeT I>
constexpr decltype(auto) MFormat<N>::get(std::integral_constant<SizeT,I> i) const
constexpr decltype(auto) MFormat<N>::get(CSizeT<I> i) const
{
return std::get<I>(mB);
}
template <SizeT N>
template <SizeT I>
constexpr decltype(auto) MFormat<N>::operator[](std::integral_constant<SizeT,I> i) const
constexpr decltype(auto) MFormat<N>::operator[](CSizeT<I> i) const
{
return get(i);
}
@ -81,19 +81,19 @@ namespace CNORXZ
template <class... PosT>
constexpr decltype(auto) GMFormat<PosT...>::size() const
{
return std::integral_constant<SizeT,sizeof...(PosT)>{};
return CSizeT<sizeof...(PosT)>{};
}
template <class... PosT>
template <SizeT I>
constexpr decltype(auto) GMFormat<PosT...>::get(std::integral_constant<SizeT,I> i) const
constexpr decltype(auto) GMFormat<PosT...>::get(CSizeT<I> i) const
{
return std::get<I>(mB);
}
template <class... PosT>
template <SizeT I>
constexpr decltype(auto) GMFormat<PosT...>::operator[](std::integral_constant<SizeT,I> i) const
constexpr decltype(auto) GMFormat<PosT...>::operator[](CSizeT<I> i) const
{
return get(i);
}
@ -123,13 +123,13 @@ namespace CNORXZ
}
template <SizeT I>
const UPos& YFormat::get(std::integral_constant<SizeT,I> i) const
const UPos& YFormat::get(CSizeT<I> i) const
{
return mB[i];
}
template <SizeT I>
const UPos& YFormat::operator[](std::integral_constant<SizeT,I> i) const
const UPos& YFormat::operator[](CSizeT<I> i) const
{
return mB[i];
}

View file

@ -23,10 +23,10 @@ namespace CNORXZ
constexpr decltype(auto) size() const;
template <SizeT I>
constexpr decltype(auto) get(std::integral_constant<SizeT,I> i) const;
constexpr decltype(auto) get(CSizeT<I> i) const;
template <SizeT I>
constexpr decltype(auto) operator[](std::integral_constant<SizeT,I> i) const;
constexpr decltype(auto) operator[](CSizeT<I> i) const;
private:
Arr<UPos,N> mB;
@ -50,10 +50,10 @@ namespace CNORXZ
constexpr decltype(auto) size() const;
template <SizeT I>
constexpr decltype(auto) get(std::integral_constant<SizeT,I> i) const;
constexpr decltype(auto) get(CSizeT<I> i) const;
template <SizeT I>
constexpr decltype(auto) operator[](std::integral_constant<SizeT,I> i) const;
constexpr decltype(auto) operator[](CSizeT<I> i) const;
private:
Tuple<PosT...> mB;
@ -77,10 +77,10 @@ namespace CNORXZ
SizeT size() const;
template <SizeT I>
const UPos& get(std::integral_constant<SizeT,I> i) const;
const UPos& get(CSizeT<I> i) const;
template <SizeT I>
const UPos& operator[](std::integral_constant<SizeT,I> i) const;
const UPos& operator[](CSizeT<I> i) const;
const UPos& get(SizeT i) const;
const UPos& operator[](SizeT i) const;

View file

@ -16,7 +16,7 @@ namespace CNORXZ
Isq<Is...> is)
{
static_assert(sizeof...(Is) == sizeof...(Indices), "inconsistent index sequence");
return MIndex<Indices...,I>( a.pack()[std::integral_constant<SizeT,Is>{}]...,
return MIndex<Indices...,I>( a.pack()[CSizeT<Is>{}]...,
std::make_shared<I>(b.THIS()) );
}
@ -27,7 +27,7 @@ namespace CNORXZ
{
static_assert(sizeof...(Js) == sizeof...(Indices), "inconsistent index sequence");
return MIndex<Indices...,I>( std::make_shared<I>(a.THIS()),
b.pack()[std::integral_constant<SizeT,Js>{}]... );
b.pack()[CSizeT<Js>{}]... );
}
template <class BlockT1, class... Indices1, class BlockT2, class... Indices2,
@ -38,8 +38,8 @@ namespace CNORXZ
{
static_assert(sizeof...(Is) == sizeof...(Indices1), "inconsistent index sequence");
static_assert(sizeof...(Js) == sizeof...(Indices2), "inconsistent index sequence");
return MIndex<Indices1...,Indices2...>( a.pack()[std::integral_constant<SizeT,Is>{}]...,
b.pack()[std::integral_constant<SizeT,Js>{}]... );
return MIndex<Indices1...,Indices2...>( a.pack()[CSizeT<Is>{}]...,
b.pack()[CSizeT<Js>{}]... );
}
/*********************
@ -51,7 +51,7 @@ namespace CNORXZ
const Sptr<I>& b, Isq<Is...> is)
{
static_assert(sizeof...(Is) == sizeof...(Indices), "inconsistent index sequence");
return std::make_shared<MIndex<Indices...,I>>( a->pack()[std::integral_constant<SizeT,Is>{}]..., b );
return std::make_shared<MIndex<Indices...,I>>( a->pack()[CSizeT<Is>{}]..., b );
}
template <class BlockT, class... Indices, class I, typename Meta, SizeT... Js>
@ -60,7 +60,7 @@ namespace CNORXZ
Isq<Js...> js)
{
static_assert(sizeof...(Js) == sizeof...(Indices), "inconsistent index sequence");
return std::make_shared<MIndex<I,Indices...>>( a, b->pack()[std::integral_constant<SizeT,Js>{}]... );
return std::make_shared<MIndex<I,Indices...>>( a, b->pack()[CSizeT<Js>{}]... );
}
template <class BlockT1, class... Indices1, class BlockT2, class... Indices2,
@ -71,8 +71,8 @@ namespace CNORXZ
{
static_assert(sizeof...(Is) == sizeof...(Indices1), "inconsistent index sequence");
static_assert(sizeof...(Js) == sizeof...(Indices2), "inconsistent index sequence");
return MIndex<Indices1...,Indices2...>( a->pack()[std::integral_constant<SizeT,Is>{}]...,
b->pack()[std::integral_constant<SizeT,Js>{}]... );
return MIndex<Indices1...,Indices2...>( a->pack()[CSizeT<Is>{}]...,
b->pack()[CSizeT<Js>{}]... );
}

View file

@ -24,14 +24,14 @@ namespace CNORXZ
template <class... Indices>
template <SizeT I>
constexpr decltype(auto) SPack<Indices...>::get(std::integral_constant<SizeT,I> i) const
constexpr decltype(auto) SPack<Indices...>::get(CSizeT<I> i) const
{
return std::get<I>(mIs);
}
template <class... Indices>
template <SizeT I>
constexpr decltype(auto) SPack<Indices...>::operator[](std::integral_constant<SizeT,I> i) const
constexpr decltype(auto) SPack<Indices...>::operator[](CSizeT<I> i) const
{
return get(i);
}

View file

@ -20,10 +20,10 @@ namespace CNORXZ
constexpr SizeT size() const;
template <SizeT I>
constexpr decltype(auto) get(std::integral_constant<SizeT,I> i) const;
constexpr decltype(auto) get(CSizeT<I> i) const;
template <SizeT I>
constexpr decltype(auto) operator[](std::integral_constant<SizeT,I> i) const;
constexpr decltype(auto) operator[](CSizeT<I> i) const;
template <class Index>
constexpr decltype(auto) rmul(const Sptr<Index>& i) const;

View file

@ -73,7 +73,7 @@ namespace CNORXZ
template <SizeT I>
inline void GMIndex<FormatT,Indices...>::up()
{
constexpr std::integral_constant<SizeT,I> i;
constexpr CSizeT<I> i;
auto& ind = mIPack[i];
if constexpr(I != 0){
if(ind->lex() == ind->lmax().val()-1){
@ -97,7 +97,7 @@ namespace CNORXZ
template <SizeT I>
inline void GMIndex<FormatT,Indices...>::down()
{
constexpr std::integral_constant<SizeT,I> i;
constexpr CSizeT<I> i;
auto& ind = mIPack[i];
if constexpr(I != 0){
if(ind->lex() == 0){
@ -121,7 +121,7 @@ namespace CNORXZ
template <SizeT I, class Xpr, class F>
constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkIFor(const Xpr& xpr, F&& f) const
{
constexpr std::integral_constant<SizeT,I> i;
constexpr CSizeT<I> i;
if constexpr(I == sizeof...(Indices)-1){
return mIPack[i]->ifor(xpr,std::forward<F>(f));
}
@ -388,7 +388,7 @@ namespace CNORXZ
return iter<1,NI>
( [&](auto i) { return mIPack[i]->stringMeta(); },
[&](const auto&... xs) {
return blim + mIPack[std::integral_constant<SizeT,0>{}]->stringMeta() + ( (dlim + xs) + ... ) + elim;
return blim + mIPack[CSizeT<0>{}]->stringMeta() + ( (dlim + xs) + ... ) + elim;
} );
}

View file

@ -194,8 +194,8 @@ namespace
for(auto xxi = mrx->begin(); xxi != endxxi; ++xxi){
EXPECT_EQ(xxi.pos(), cnt);
EXPECT_EQ(xxi.lex(), cnt);
auto ci = xxi.pack()[std::integral_constant<SizeT,0>{}];
auto ui = xxi.pack()[std::integral_constant<SizeT,1>{}];
auto ci = xxi.pack()[CSizeT<0>{}];
auto ui = xxi.pack()[CSizeT<1>{}];
Tuple<SizeT,String> meta(*(*ci),*(*ui));
auto meta2 = mkm(cnt);
EXPECT_EQ(meta, meta2);
@ -252,9 +252,9 @@ namespace
for(auto xxi = mrx->begin(); xxi != endxxi; ++xxi){
EXPECT_EQ(xxi.pos(), cnt);
EXPECT_EQ(xxi.lex(), cnt);
auto ci1 = xxi.pack()[std::integral_constant<SizeT,0>{}];
auto ui = xxi.pack()[std::integral_constant<SizeT,1>{}];
auto ci2 = xxi.pack()[std::integral_constant<SizeT,2>{}];
auto ci1 = xxi.pack()[CSizeT<0>{}];
auto ui = xxi.pack()[CSizeT<1>{}];
auto ci2 = xxi.pack()[CSizeT<2>{}];
Tuple<SizeT,String,SizeT> meta(*(*ci1),*(*ui),*(*ci2));
auto meta2 = mkm(cnt);
EXPECT_EQ(meta, meta2);