|
|
@@ -11,15 +11,16 @@ namespace program {
|
|
|
template <typename Impl>
|
|
|
template <typename T>
|
|
|
Arguments<Impl>::Argument::operator T() const {
|
|
|
- return (*this) ? convert<T>(self->arguments.at(index)) : T();
|
|
|
+ if (!primed()) {
|
|
|
+ return T();
|
|
|
+ } else if (self->arguments.size() > index) {
|
|
|
+ return convert<T>(self->arguments.at(index));
|
|
|
+ }
|
|
|
+ throw IllegalPositionError("No argument provided", index);
|
|
|
}
|
|
|
|
|
|
template <typename Impl> Arguments<Impl>::Argument::operator bool() const {
|
|
|
- bool const good = primed();
|
|
|
- if (good && self->arguments.size() <= index) {
|
|
|
- throw IllegalPositionError("No argument provided", index);
|
|
|
- }
|
|
|
- return good;
|
|
|
+ return primed() && self->arguments.size() > index;
|
|
|
}
|
|
|
|
|
|
template <typename Impl>
|