virtual inheritance for better readability and decoupling
parent
b4fe033d12
commit
87ea6341f2
|
@ -96,7 +96,7 @@ struct ReverseADImplementor; // forward for CallRecord's friend declaration
|
||||||
* It is implemented in the function-style ExpressionNode's nested Record class below.
|
* It is implemented in the function-style ExpressionNode's nested Record class below.
|
||||||
*/
|
*/
|
||||||
template<int Cols>
|
template<int Cols>
|
||||||
struct CallRecord: private internal::ReverseADInterface<MaxVirtualStaticRows,
|
struct CallRecord: virtual private internal::ReverseADInterface<MaxVirtualStaticRows,
|
||||||
Cols> {
|
Cols> {
|
||||||
|
|
||||||
inline void print(const std::string& indent) const {
|
inline void print(const std::string& indent) const {
|
||||||
|
@ -154,9 +154,10 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived, int Cols>
|
template<typename Derived, int Cols>
|
||||||
struct ReverseADImplementor<Derived, 0, Cols> : CallRecord<Cols> {
|
struct ReverseADImplementor<Derived, 0, Cols>
|
||||||
|
: virtual internal::ReverseADInterface<MaxVirtualStaticRows, Cols> {
|
||||||
private:
|
private:
|
||||||
using CallRecord<Cols>::_reverseAD;
|
using internal::ReverseADInterface<MaxVirtualStaticRows, Cols>::_reverseAD;
|
||||||
const Derived & derived() const {
|
const Derived & derived() const {
|
||||||
return static_cast<const Derived&>(*this);
|
return static_cast<const Derived&>(*this);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,7 @@ private:
|
||||||
*/
|
*/
|
||||||
template<typename Derived, int Cols>
|
template<typename Derived, int Cols>
|
||||||
struct CallRecordImplementor: ReverseADImplementor<Derived,
|
struct CallRecordImplementor: ReverseADImplementor<Derived,
|
||||||
MaxVirtualStaticRows, Cols> {
|
MaxVirtualStaticRows, Cols>, CallRecord<Cols>{
|
||||||
private:
|
private:
|
||||||
const Derived & derived() const {
|
const Derived & derived() const {
|
||||||
return static_cast<const Derived&>(*this);
|
return static_cast<const Derived&>(*this);
|
||||||
|
|
Loading…
Reference in New Issue