SF [2360817] Build failure in Var.cpp

This commit is contained in:
Aleksandar Fabijanic 2008-11-30 03:54:11 +00:00
parent 69ee9eee82
commit 905534af1c
2 changed files with 14 additions and 6 deletions

View File

@ -435,8 +435,8 @@ public:
return holderImpl<std::vector<Var>,
InvalidAccessException>("Not an array.")->operator[](n);
else if (isStruct())
return holderImpl<Struct<int>,
InvalidAccessException>("Not a struct.")->operator[](n);
return structIndexOperator(holderImpl<Struct<int>,
InvalidAccessException>("Not a struct."), n);
else
throw InvalidAccessException("Must be struct or array.");
}
@ -447,11 +447,11 @@ public:
/// returns true! In all other cases InvalidAccessException is thrown.
{
if (isArray())
return const_cast<const Var&>(holderImpl<std::vector<Var>,
InvalidAccessException>("Not an array.")->operator[](n));
return holderImpl<std::vector<Var>,
InvalidAccessException>("Not an array.")->operator[](n);
else if (isStruct())
return const_cast<const Var&>(holderImpl<Struct<int>,
InvalidAccessException>("Not a struct.")->operator[](n));
return structIndexOperator(holderImpl<Struct<int>,
InvalidAccessException>("Not a struct."), n);
else
throw InvalidAccessException("Must be struct or array.");
}
@ -545,6 +545,8 @@ private:
throw E(errorMessage);
}
Var& structIndexOperator(VarHolderImpl<Struct<int> >* pStr, int n) const;
VarHolder* _pHolder;
};

View File

@ -477,4 +477,10 @@ std::string Var::toString(const Var& any)
}
Var& Var::structIndexOperator(VarHolderImpl<Struct<int> >* pStr, int n) const
{
return pStr->operator[](n);
}
} } // namespace Poco::Dynamic