@ -128,8 +128,10 @@ TEST(Layout, ElementTypes) {
{
using L = Layout < int32_t , int32_t > ;
SameType < std : : tuple < int32_t , int32_t > , L : : ElementTypes > ( ) ;
SameType < std : : tuple < int32_t , int32_t > , decltype ( L : : Partial ( ) ) : : ElementTypes > ( ) ;
SameType < std : : tuple < int32_t , int32_t > , decltype ( L : : Partial ( 0 ) ) : : ElementTypes > ( ) ;
SameType < std : : tuple < int32_t , int32_t > ,
decltype ( L : : Partial ( ) ) : : ElementTypes > ( ) ;
SameType < std : : tuple < int32_t , int32_t > ,
decltype ( L : : Partial ( 0 ) ) : : ElementTypes > ( ) ;
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
@ -368,18 +370,21 @@ TEST(Layout, PointerByIndex) {
{
using L = Layout < int32_t > ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L ( 3 ) . Pointer < 0 > ( p ) ) ) ) ;
}
{
using L = Layout < int32_t , int32_t > ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 12 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 , 5 ) . Pointer < 0 > ( p ) ) ) ) ;
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 12 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 , 5 ) . Pointer < 1 > ( p ) ) ) ) ;
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 , 5 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ (
12 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 , 5 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L ( 3 , 5 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 12 , Distance ( p , Type < const int32_t * > ( L ( 3 , 5 ) . Pointer < 1 > ( p ) ) ) ) ;
}
@ -387,39 +392,44 @@ TEST(Layout, PointerByIndex) {
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 4 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 , 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 0 , 0 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 , 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 4 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ (
4 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 1 , 0 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 , 3 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 , 3 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 , 3 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 24 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 5 , 3 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const Int128 * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ (
4 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
4 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < const Int128 * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ (
@ -428,7 +438,8 @@ TEST(Layout, PointerByIndex) {
24 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 1 > ( p ) ) ) ) ;
8 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > ( L ( 5 , 3 , 1 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 24 , Distance ( p , Type < const Int128 * > ( L ( 5 , 3 , 1 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < const int32_t * > ( L ( 5 , 3 , 1 ) . Pointer < 1 > ( p ) ) ) ) ;
@ -439,75 +450,78 @@ TEST(Layout, PointerByType) {
alignas ( max_align_t ) const unsigned char p [ 100 ] = { } ;
{
using L = Layout < int32_t > ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int32_t * > ( L : : Partial ( ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > ( L ( 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int32 _t * > ( L : : Partial ( 0 , 0 ) . Pointer < int32 _t > ( p ) ) ) ) ;
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
4 , Distance ( p , Type < const int32 _t * > ( L : : Partial ( 1 , 0 ) . Pointer < int32 _t > ( p ) ) ) ) ;
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 1 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
4 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int8_t > ( p ) ) ) ) ;
0 , Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
8 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
24 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 5 , 3 ) . Pointer < Int128 > ( p ) ) ) ) ;
0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > (
L : : Partial ( 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
Distance ( p , Type < const Int128 * > ( L : : Partial ( 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const Int128 * > (
L : : Partial ( 0 , 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < const int32_t * > (
L : : Partial ( 1 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 1 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < const int32_t * > (
L : : Partial ( 5 , 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
4 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
24 ,
Distance ( p , Type < const Int128 * > ( L : : Partial ( 5 , 3 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > (
L : : Partial ( 0 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int32_t * > (
L : : Partial ( 0 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const Int128 * > (
L : : Partial ( 0 , 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > (
L : : Partial ( 1 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < const int32_t * > (
L : : Partial ( 1 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < const Int128 * > (
L : : Partial ( 1 , 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < const int8_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < const int8_t * > (
L : : Partial ( 5 , 3 , 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 24 , Distance ( p , Type < const Int128 * > (
L : : Partial ( 5 , 3 , 1 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < const int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < const int32_t * > (
L : : Partial ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 24 ,
Distance ( p , Type < const Int128 * > ( L ( 5 , 3 , 1 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < const int32_t * > ( L ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < const int32_t * > ( L ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
}
}
@ -548,15 +562,18 @@ TEST(Layout, MutablePointerByIndex) {
EXPECT_EQ ( 8 , Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 24 , Distance ( p , Type < Int128 * > ( L : : Partial ( 5 , 3 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Int128 * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 4 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < Int128 * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 24 ,
Distance ( p , Type < Int128 * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < 1 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L ( 5 , 3 , 1 ) . Pointer < 0 > ( p ) ) ) ) ;
EXPECT_EQ ( 24 , Distance ( p , Type < Int128 * > ( L ( 5 , 3 , 1 ) . Pointer < 2 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < int32_t * > ( L ( 5 , 3 , 1 ) . Pointer < 1 > ( p ) ) ) ) ;
@ -568,48 +585,61 @@ TEST(Layout, MutablePointerByType) {
{
using L = Layout < int32_t > ;
EXPECT_EQ ( 0 , Distance ( p , Type < int32_t * > ( L : : Partial ( ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int32_t * > ( L : : Partial ( 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int32_t * > ( L ( 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int32_t * > ( L : : Partial ( 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < int32_t * > ( L : : Partial ( 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 5 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < int32_t * > ( L : : Partial ( 5 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int32_t * > ( L : : Partial ( 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 5 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int8_t * > ( L : : Partial ( 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < int32_t * > ( L : : Partial ( 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Int128 * > ( L : : Partial ( 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 1 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < int32_t * > ( L : : Partial ( 1 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int8_t * > ( L : : Partial ( 1 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
4 , Distance ( p , Type < int32_t * > ( L : : Partial ( 1 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < Int128 * > ( L : : Partial ( 1 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int8_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 24 ,
Distance ( p , Type < Int128 * > ( L : : Partial ( 5 , 3 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int8_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Int128 * > ( L : : Partial ( 0 , 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int8_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 4 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
4 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < Int128 * > ( L : : Partial ( 1 , 0 , 0 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < int8_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < int8_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ (
24 , Distance ( p , Type < Int128 * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < int32_t * > ( L : : Partial ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < int8_t * > ( L ( 5 , 3 , 1 ) . Pointer < int8_t > ( p ) ) ) ) ;
EXPECT_EQ ( 24 , Distance ( p , Type < Int128 * > ( L ( 5 , 3 , 1 ) . Pointer < Int128 > ( p ) ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < int32_t * > ( L ( 5 , 3 , 1 ) . Pointer < int32_t > ( p ) ) ) ) ;
@ -790,67 +820,72 @@ TEST(Layout, SliceByIndexData) {
{
using L = Layout < int32_t > ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int32_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const int32_t > > ( L ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < const int32_t > > ( L ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
}
{
using L = Layout < int32_t , int32_t > ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p ,
Type < Span < const int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
12 ,
Distance ( p ,
Type < Span < const int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < const int32_t > > ( L ( 3 , 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 12 ,
Distance ( p , Type < Span < const int32_t > > ( L ( 3 , 5 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < const int32_t > > ( L ( 3 , 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
12 , Distance ( p , Type < Span < const int32_t > > ( L ( 3 , 5 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int8_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int8_t > > ( L : : Partial ( 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int8_t > > ( L : : Partial ( 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
p , Type < Span < const int8_t > > ( L : : Partial ( 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p ,
Type < Span < const int32 _t > > ( L : : Partial ( 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
Distance (
p , Type < Span < const int8 _t > > ( L : : Partial ( 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 ,
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance ( p ,
Type < Span < const int32_t > > ( L : : Partial ( 1 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 1 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p ,
Type < Span < const int32_t > > ( L : : Partial ( 5 , 3 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 5 , 3 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < const int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
@ -864,7 +899,8 @@ TEST(Layout, SliceByIndexData) {
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < const int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance (
@ -878,7 +914,8 @@ TEST(Layout, SliceByIndexData) {
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
24 ,
Distance (
@ -890,12 +927,14 @@ TEST(Layout, SliceByIndexData) {
p ,
Type < Span < const int32_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < const int8_t > > ( L ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < const int8_t > > ( L ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
24 ,
Distance ( p , Type < Span < const Int128 > > ( L ( 5 , 3 , 1 ) . Slice < 2 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < Span < const int32_t > > ( L ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
8 ,
Distance ( p , Type < Span < const int32_t > > ( L ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
}
}
@ -906,98 +945,94 @@ TEST(Layout, SliceByTypeData) {
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < const int32_t > > ( L : : Partial ( 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int32_t > > ( L : : Partial ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < const int32_t > > ( L : : Partial ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < const int32_t > > ( L ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < const int32_t > > ( L ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 5 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p ,
Type < Span < const int32 _t > > ( L : : Partial ( 0 , 0 ) . Slice < int32 _t > ( p ) ) . data ( ) ) ) ;
Type < Span < const int8_t > > ( L : : Partial ( 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance (
p ,
Type < Span < const int32 _t > > ( L : : Partial ( 1 , 0 ) . Slice < int32 _t > ( p ) ) . data ( ) ) ) ;
Type < Span < const int8_t > > ( L : : Partial ( 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 ,
Distance (
p ,
Type < Span < const int32 _t > > ( L : : Partial ( 5 , 3 ) . Slice < int32 _t > ( p ) ) . data ( ) ) ) ;
Type < Span < const int8_t > > ( L : : Partial ( 5 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p ,
Type < Span < const int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
Distance ( p , Type < Span < const int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < int8_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const int32_t > > (
L : : Partial ( 0 , 0 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int32 _t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < int32 _t > ( p ) )
Distance ( p , Type < Span < const int8 _t > > ( L : : Partial ( 1 , 0 ) . Slice < int8 _t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const Int128 > > (
L : : Partial ( 0 , 0 , 0 ) . Slice < Int128 > ( p ) )
EXPECT_EQ ( 4 , Distance ( p , Type < Span < const int32_t > > (
L : : Partial ( 1 , 0 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p ,
Type < Span < const int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance ( p , Type < Span < const int32_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < int32_t > ( p ) )
Distance ( p , Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < int8_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < Span < const int32_t > > (
L : : Partial ( 5 , 3 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const int8_t > > (
L : : Partial ( 0 , 0 , 0 ) . Slice < int8_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const int32_t > > (
L : : Partial ( 0 , 0 , 0 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const Int128 > > (
L : : Partial ( 0 , 0 , 0 ) . Slice < Int128 > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const int8_t > > (
L : : Partial ( 1 , 0 , 0 ) . Slice < int8_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 4 , Distance ( p , Type < Span < const int32_t > > (
L : : Partial ( 1 , 0 , 0 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < Span < const Int128 > > (
L : : Partial ( 1 , 0 , 0 ) . Slice < Int128 > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p ,
Type < Span < const int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < const int8_t > > (
L : : Partial ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 24 , Distance ( p , Type < Span < const Int128 > > (
L : : Partial ( 5 , 3 , 1 ) . Slice < Int128 > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < Span < const int32_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < Span < const int32_t > > (
L : : Partial ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) )
. data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < const int8_t > > ( L ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
Distance ( p ,
Type < Span < const int8_t > > ( L ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
24 ,
Distance ( p ,
Type < Span < const Int128 > > ( L ( 5 , 3 , 1 ) . Slice < Int128 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 , Distance (
p , Type < Span < const int32_t > > ( L ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
8 ,
Distance (
p , Type < Span < const int32_t > > ( L ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
}
}
@ -1005,18 +1040,19 @@ TEST(Layout, MutableSliceByIndexData) {
alignas ( max_align_t ) unsigned char p [ 100 ] ;
{
using L = Layout < int32_t > ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < int32_t > > ( L ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
}
{
using L = Layout < int32_t , int32_t > ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
12 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 , 5 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
@ -1025,55 +1061,63 @@ TEST(Layout, MutableSliceByIndexData) {
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int32 _t > > ( L : : Partial ( 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 , Distance ( p , Type < Span < int32 _t > > ( L : : Partial ( 1 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 1 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < Int128 > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < 2 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
4 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 , Distance (
p , Type < Span < Int128 > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < 2 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
24 , Distance (
p , Type < Span < Int128 > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 2 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < int8_t > > ( L ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
8 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int8_t > > ( L ( 5 , 3 , 1 ) . Slice < 0 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 24 ,
Distance ( p , Type < Span < Int128 > > ( L ( 5 , 3 , 1 ) . Slice < 2 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 8 , Distance ( p , Type < Span < int32_t > > ( L ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 8 ,
Distance ( p , Type < Span < int32_t > > ( L ( 5 , 3 , 1 ) . Slice < 1 > ( p ) ) . data ( ) ) ) ;
}
}
@ -1082,66 +1126,84 @@ TEST(Layout, MutableSliceByTypeData) {
{
using L = Layout < int32_t > ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int32_t > > ( L : : Partial ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 , Distance ( p , Type < Span < int32_t > > ( L ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
0 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int32_t > > ( L ( 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
}
{
using L = Layout < int8_t , int32_t , Int128 > ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
Distance ( p ,
Type < Span < int8_t > > ( L : : Partial ( 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 0 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 0 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
Distance ( p ,
Type < Span < int8_t > > ( L : : Partial ( 1 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 1 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
4 ,
Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 1 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance ( p , Type < Span < int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
Distance ( p ,
Type < Span < int8_t > > ( L : : Partial ( 5 , 3 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 , Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
8 ,
Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance (
p ,
Type < Span < int8_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < int32_t > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 ,
Distance (
p ,
Type < Span < Int128 > > ( L : : Partial ( 0 , 0 , 0 ) . Slice < Int128 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance (
p ,
Type < Span < int8_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
4 ,
Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < int32_t > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 ,
Distance (
p ,
Type < Span < Int128 > > ( L : : Partial ( 1 , 0 , 0 ) . Slice < Int128 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance (
p , Type < Span < int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
0 ,
Distance (
p ,
Type < Span < int8_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
24 ,
Distance (
@ -1150,14 +1212,16 @@ TEST(Layout, MutableSliceByTypeData) {
EXPECT_EQ (
8 ,
Distance (
p , Type < Span < int32_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ ( 0 ,
Distance ( p , Type < Span < int8_t > > ( L ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
p ,
Type < Span < int32_t > > ( L : : Partial ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
0 , Distance ( p , Type < Span < int8_t > > ( L ( 5 , 3 , 1 ) . Slice < int8_t > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
24 ,
Distance ( p , Type < Span < Int128 > > ( L ( 5 , 3 , 1 ) . Slice < Int128 > ( p ) ) . data ( ) ) ) ;
EXPECT_EQ (
8 , Distance ( p , Type < Span < int32_t > > ( L ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
8 ,
Distance ( p , Type < Span < int32_t > > ( L ( 5 , 3 , 1 ) . Slice < int32_t > ( p ) ) . data ( ) ) ) ;
}
}
@ -1256,17 +1320,17 @@ TEST(Layout, MutableSlices) {
}
{
const auto x = L : : Partial ( 1 , 2 , 3 ) ;
EXPECT_THAT (
( Type < std : : tuple < Span < int8_t > , Span < int8_t > , Span < Int128 > > > ( x . Slices ( p ) ) ) ,
Tuple ( IsSameSlice ( x . Slice < 0 > ( p ) ) , IsSameSlice ( x . Slice < 1 > ( p ) ) ,
IsSameSlice ( x . Slice < 2 > ( p ) ) ) ) ;
EXPECT_THAT ( ( Type < std : : tuple < Span < int8_t > , Span < int8_t > , Span < Int128 > > > (
x . Slices ( p ) ) ) ,
Tuple ( IsSameSlice ( x . Slice < 0 > ( p ) ) , IsSameSlice ( x . Slice < 1 > ( p ) ) ,
IsSameSlice ( x . Slice < 2 > ( p ) ) ) ) ;
}
{
const L x ( 1 , 2 , 3 ) ;
EXPECT_THAT (
( Type < std : : tuple < Span < int8_t > , Span < int8_t > , Span < Int128 > > > ( x . Slices ( p ) ) ) ,
Tuple ( IsSameSlice ( x . Slice < 0 > ( p ) ) , IsSameSlice ( x . Slice < 1 > ( p ) ) ,
IsSameSlice ( x . Slice < 2 > ( p ) ) ) ) ;
EXPECT_THAT ( ( Type < std : : tuple < Span < int8_t > , Span < int8_t > , Span < Int128 > > > (
x . Slices ( p ) ) ) ,
Tuple ( IsSameSlice ( x . Slice < 0 > ( p ) ) , IsSameSlice ( x . Slice < 1 > ( p ) ) ,
IsSameSlice ( x . Slice < 2 > ( p ) ) ) ) ;
}
}
@ -1398,7 +1462,8 @@ TEST(Layout, DebugString) {
x . DebugString ( ) ) ;
}
{
constexpr auto x = Layout < int8_t , int32_t , int8_t , Int128 > : : Partial ( 1 , 2 , 3 ) ;
constexpr auto x =
Layout < int8_t , int32_t , int8_t , Int128 > : : Partial ( 1 , 2 , 3 ) ;
EXPECT_EQ (
" @0<signed char>(1)[1]; @4<int>(4)[2]; @12<signed char>(1)[3]; "
" @16 " +
@ -1406,7 +1471,8 @@ TEST(Layout, DebugString) {
x . DebugString ( ) ) ;
}
{
constexpr auto x = Layout < int8_t , int32_t , int8_t , Int128 > : : Partial ( 1 , 2 , 3 , 4 ) ;
constexpr auto x =
Layout < int8_t , int32_t , int8_t , Int128 > : : Partial ( 1 , 2 , 3 , 4 ) ;
EXPECT_EQ (
" @0<signed char>(1)[1]; @4<int>(4)[2]; @12<signed char>(1)[3]; "
" @16 " +