From f625e90a0721483f7f44b94b9bb57cc9d59565e8 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 10 Feb 2017 11:48:58 -0500 Subject: Added negative filter conversions to objects --- lib/word.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lib/word.h') diff --git a/lib/word.h b/lib/word.h index dd72c39..e866f09 100644 --- a/lib/word.h +++ b/lib/word.h @@ -105,8 +105,6 @@ namespace verbly { const std::vector
& getInflections(inflection category) const; - - // Type info static const object objectType; @@ -121,9 +119,24 @@ namespace verbly { operator filter() const { + if (!valid_) + { + throw std::domain_error("Bad access to uninitialized word"); + } + return (id == id_); } + filter operator!() const + { + if (!valid_) + { + throw std::domain_error("Bad access to uninitialized word"); + } + + return (id != id_); + } + // Relationships with other objects static const field notions; -- cgit 1.4.1