@@ -298,8 +298,41 @@ namespace xt
298298 {
299299 using fixed_tensor = xtensor_fixed<double , xshape<2 >, layout_type::row_major, true >;
300300 using tiny_tensor = xtensor_fixed<double , xshape<2 >, layout_type::row_major, false >;
301- EXPECT_GT (sizeof (fixed_tensor), sizeof (tiny_tensor));
301+ EXPECT_GT (sizeof (fixed_tensor), sizeof (tiny_tensor));
302302 }
303+
304+ class FixedMember
305+ {
306+ public:
307+ FixedMember (size_t bar, double foo)
308+ {
309+ m_bar = bar;
310+ m_foo = foo;
311+ m_I = xt::xtensor_fixed<double , xt::xshape<2 , 2 >>({{1.0 , 0.0 },
312+ {0.0 , 1.0 }});
313+ }
314+
315+ xt::xtensor_fixed<double , xt::xshape<2 , 2 >> get () const
316+ {
317+ xt::xtensor_fixed<double , xt::xshape<2 , 2 >> ret = 2.0 * m_I;
318+ return ret;
319+ }
320+
321+ private:
322+ size_t m_bar;
323+ double m_foo;
324+ xt::xtensor_fixed<double , xt::xshape<2 , 2 >> m_I;
325+ };
326+
327+ TEST (xtensor_fixed, member)
328+ {
329+ FixedMember c (20 , 1.2 );
330+ auto m = c.get ();
331+ auto r = xt::xtensor_fixed<double , xt::xshape<2 , 2 >>({{2.0 , 0.0 },
332+ {0.0 , 2.0 }});
333+ EXPECT_TRUE (xt::all (xt::equal (m, r)));
334+ }
335+
303336}
304337
305338#endif
0 commit comments