@@ -1073,14 +1073,14 @@ struct TreeAdapter
10731073 using ConstAccessorType = typename tree::ValueAccessor<const TreeType>;
10741074 using NonConstAccessorType = typename tree::ValueAccessor<NonConstTreeType>;
10751075
1076- static TreeType & tree (TreeType & t) { return t; }
1077- static TreeType & tree (GridType & g) { return g.tree (); }
1078- static const TreeType & tree (const TreeType & t) { return t; }
1079- static const TreeType & tree (const GridType & g) { return g.tree (); }
1080- static const TreeType & constTree (TreeType & t) { return t; }
1081- static const TreeType & constTree (GridType & g) { return g.constTree (); }
1082- static const TreeType & constTree (const TreeType & t) { return t; }
1083- static const TreeType & constTree (const GridType & g) { return g.constTree (); }
1076+ static NonConstTreeType & tree (NonConstTreeType & t) { return t; }
1077+ static NonConstTreeType & tree (NonConstGridType & g) { return g.tree (); }
1078+ static const NonConstTreeType & tree (const NonConstTreeType & t) { return t; }
1079+ static const NonConstTreeType & tree (const NonConstGridType & g) { return g.tree (); }
1080+ static const NonConstTreeType & constTree (NonConstTreeType & t) { return t; }
1081+ static const NonConstTreeType & constTree (NonConstGridType & g) { return g.constTree (); }
1082+ static const NonConstTreeType & constTree (const NonConstTreeType & t) { return t; }
1083+ static const NonConstTreeType & constTree (const NonConstGridType & g) { return g.constTree (); }
10841084};
10851085
10861086
@@ -1103,14 +1103,43 @@ struct TreeAdapter<Grid<_TreeType> >
11031103 using ConstAccessorType = typename tree::ValueAccessor<const TreeType>;
11041104 using NonConstAccessorType = typename tree::ValueAccessor<NonConstTreeType>;
11051105
1106- static TreeType& tree (TreeType& t) { return t; }
1107- static TreeType& tree (GridType& g) { return g.tree (); }
1108- static const TreeType& tree (const TreeType& t) { return t; }
1109- static const TreeType& tree (const GridType& g) { return g.tree (); }
1110- static const TreeType& constTree (TreeType& t) { return t; }
1111- static const TreeType& constTree (GridType& g) { return g.constTree (); }
1112- static const TreeType& constTree (const TreeType& t) { return t; }
1113- static const TreeType& constTree (const GridType& g) { return g.constTree (); }
1106+ static NonConstTreeType& tree (NonConstTreeType& t) { return t; }
1107+ static NonConstTreeType& tree (NonConstGridType& g) { return g.tree (); }
1108+ static const NonConstTreeType& tree (const NonConstTreeType& t) { return t; }
1109+ static const NonConstTreeType& tree (const NonConstGridType& g) { return g.tree (); }
1110+ static const NonConstTreeType& constTree (NonConstTreeType& t) { return t; }
1111+ static const NonConstTreeType& constTree (NonConstGridType& g) { return g.constTree (); }
1112+ static const NonConstTreeType& constTree (const NonConstTreeType& t) { return t; }
1113+ static const NonConstTreeType& constTree (const NonConstGridType& g) { return g.constTree (); }
1114+ };
1115+
1116+ // / Partial specialization for const Grid types
1117+ template <typename _TreeType>
1118+ struct TreeAdapter <const Grid<_TreeType> >
1119+ {
1120+ using TreeType = _TreeType;
1121+ using NonConstTreeType = typename std::remove_const<TreeType>::type;
1122+ using TreePtrType = typename TreeType::Ptr;
1123+ using ConstTreePtrType = typename TreeType::ConstPtr;
1124+ using NonConstTreePtrType = typename NonConstTreeType::Ptr;
1125+ using GridType = Grid<TreeType>;
1126+ using NonConstGridType = Grid<NonConstTreeType>;
1127+ using GridPtrType = typename GridType::Ptr;
1128+ using NonConstGridPtrType = typename NonConstGridType::Ptr;
1129+ using ConstGridPtrType = typename GridType::ConstPtr;
1130+ using ValueType = typename TreeType::ValueType;
1131+ using AccessorType = typename tree::ValueAccessor<TreeType>;
1132+ using ConstAccessorType = typename tree::ValueAccessor<const TreeType>;
1133+ using NonConstAccessorType = typename tree::ValueAccessor<NonConstTreeType>;
1134+
1135+ static NonConstTreeType& tree (NonConstTreeType& t) { return t; }
1136+ static NonConstTreeType& tree (NonConstGridType& g) { return g.tree (); }
1137+ static const NonConstTreeType& tree (const NonConstTreeType& t) { return t; }
1138+ static const NonConstTreeType& tree (const NonConstGridType& g) { return g.tree (); }
1139+ static const NonConstTreeType& constTree (NonConstTreeType& t) { return t; }
1140+ static const NonConstTreeType& constTree (NonConstGridType& g) { return g.constTree (); }
1141+ static const NonConstTreeType& constTree (const NonConstTreeType& t) { return t; }
1142+ static const NonConstTreeType& constTree (const NonConstGridType& g) { return g.constTree (); }
11141143};
11151144
11161145// / Partial specialization for ValueAccessor types
@@ -1129,19 +1158,25 @@ struct TreeAdapter<tree::ValueAccessor<_TreeType> >
11291158 using ConstGridPtrType = typename GridType::ConstPtr;
11301159 using ValueType = typename TreeType::ValueType;
11311160 using AccessorType = typename tree::ValueAccessor<TreeType>;
1132- using ConstAccessorType = typename tree::ValueAccessor<const TreeType >;
1161+ using ConstAccessorType = typename tree::ValueAccessor<const NonConstTreeType >;
11331162 using NonConstAccessorType = typename tree::ValueAccessor<NonConstTreeType>;
11341163
1135- static TreeType& tree (TreeType& t) { return t; }
1136- static TreeType& tree (GridType& g) { return g.tree (); }
1137- static TreeType& tree (AccessorType& a) { return a.tree (); }
1138- static const TreeType& tree (const TreeType& t) { return t; }
1139- static const TreeType& tree (const GridType& g) { return g.tree (); }
1140- static const TreeType& tree (const AccessorType& a) { return a.tree (); }
1141- static const TreeType& constTree (TreeType& t) { return t; }
1142- static const TreeType& constTree (GridType& g) { return g.constTree (); }
1143- static const TreeType& constTree (const TreeType& t) { return t; }
1144- static const TreeType& constTree (const GridType& g) { return g.constTree (); }
1164+ static NonConstTreeType& tree (NonConstTreeType& t) { return t; }
1165+ static NonConstTreeType& tree (NonConstGridType& g) { return g.tree (); }
1166+ static NonConstTreeType& tree (NonConstAccessorType& a) { return a.tree (); }
1167+ static const NonConstTreeType& tree (ConstAccessorType& a) { return a.tree (); }
1168+ static const NonConstTreeType& tree (const NonConstTreeType& t) { return t; }
1169+ static const NonConstTreeType& tree (const NonConstGridType& g) { return g.tree (); }
1170+ static const NonConstTreeType& tree (const NonConstAccessorType& a) { return a.tree (); }
1171+ static const NonConstTreeType& tree (const ConstAccessorType& a) { return a.tree (); }
1172+ static const NonConstTreeType& constTree (NonConstTreeType& t) { return t; }
1173+ static const NonConstTreeType& constTree (NonConstGridType& g) { return g.constTree (); }
1174+ static const NonConstTreeType& constTree (NonConstAccessorType& a) { return a.tree (); }
1175+ static const NonConstTreeType& constTree (ConstAccessorType& a) { return a.tree (); }
1176+ static const NonConstTreeType& constTree (const NonConstTreeType& t) { return t; }
1177+ static const NonConstTreeType& constTree (const NonConstGridType& g) { return g.constTree (); }
1178+ static const NonConstTreeType& constTree (const NonConstAccessorType& a) { return a.tree (); }
1179+ static const NonConstTreeType& constTree (const ConstAccessorType& a) { return a.tree (); }
11451180};
11461181
11471182// @}
0 commit comments