Topic: New C++ types std::boolean, std::true, std::false,
Author: jimsmithellis@gmail.com
Date: Sun, 23 Jun 2013 23:35:49 -0700 (PDT)
Raw View
------=_Part_2732_11362451.1372055749977
Content-Type: text/plain; charset=ISO-8859-1
Greetings,
I'm interested in an implementation of C++ types std::boolean, std::true
and std::false and another std::bool_intermediate meaning not true or
false. These types would allow developers to take control of boolean
operations using OO techniques. In addition to this std::intermediate
recognizes the possibility of an intermediate value between true and false,
or Superposition.
An implementation would allow these boolean classes to invoke the
appropriate method on an object. Boolean conditions would not always use
if/else statements because C++ function overloading would do the same more
elegantly using Multiple Dispatch. Multiple Dispatch is explained in Scott
Meyers book "More Effective C++".
usage example:
class handler_concept
{
public:
....
void operator()(const std::true<handler_concept>& bt) ;
void operator()(const std::false<handler_concept>& bf) ;
void operator()(const std::bool_intermediate<handler_concept>& bi) ;
....
};
handler_concept hc; // class object used to handle the boolean results
std::boolean<handler_concept> bln(hc); // creation of std::boolean using
class handler_concept
SomeOperation s_op; // Class object used to call method returning
std::true, std::false or std::intermediate.
bln = s_op.some_bool_function(); // std::boolean object bln invokes the
appropriate method on the handler_concept class object hc.
// end of example
I've implemented these boolean types just to try the strategy purposed. It
looks cleaner than if/else statements and allows a class to define what
true or false etc. means within its own application.
Thanks & Regards,
--Jim Smith
E-mail: JimSmithEllis@Gmail.com
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_2732_11362451.1372055749977
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Greetings,<br><br>I'm interested in an implementation of C++ types std::boo=
lean, std::true and std::false and another std::bool_intermediate meaning n=
ot true or false. These types would allow developers to take control of boo=
lean operations using OO techniques. In addition to this std::intermediate =
recognizes the possibility of an intermediate value between true and false,=
or Superposition.<br><br>An implementation would allow these boolean class=
es to invoke the appropriate method on an object. Boolean conditions would =
not always use if/else statements because C++ function overloading would do=
the same more elegantly using Multiple Dispatch. Multiple Dispatch is expl=
ained in Scott Meyers book "More Effective C++".<br><br>usage example:<br><=
br>class handler_concept<br>{<br>public:<br>...<br> void operator()(c=
onst std::true<handler_concept>& bt) ;<br> void operator()(=
const std::false<handler_concept>& bf) ;<br> void operator(=
)(const std::bool_intermediate<handler_concept>& bi) ;<br>...<br>=
};<br><br> handler_concept hc; // class object used to handle t=
he boolean results<br> std::boolean<handler_concept> bln(hc);&n=
bsp; // creation of std::boolean using class handler_concept<br><br> =
SomeOperation s_op; // Class object used to call method returning std=
::true, std::false or std::intermediate.<br> bln =3D s_op=
..some_bool_function(); // std::boolean object bln invokes the appropr=
iate method on the handler_concept class object hc.<br><br>// end of examp=
le<br><br>I've implemented these boolean types just to try the strategy pur=
posed. It looks cleaner than if/else statements and allows a class to defin=
e what true or false etc. means within its own application.<br> <br><=
br>Thanks & Regards,<br>--Jim Smith<br><br>E-mail: JimSmithEllis@Gmail.=
com<br><br>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
<br />
<br />
------=_Part_2732_11362451.1372055749977--
.