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>&nbsp; void operator()(c=
onst std::true&lt;handler_concept&gt;&amp; bt) ;<br>&nbsp; void operator()(=
const std::false&lt;handler_concept&gt;&amp; bf) ;<br>&nbsp; void operator(=
)(const std::bool_intermediate&lt;handler_concept&gt;&amp; bi) ;<br>...<br>=
};<br><br>&nbsp; handler_concept hc;&nbsp; // class object used to handle t=
he boolean results<br>&nbsp; std::boolean&lt;handler_concept&gt; bln(hc);&n=
bsp; // creation of std::boolean using class handler_concept<br><br>&nbsp; =
SomeOperation s_op;&nbsp; // Class object used to call method returning std=
::true, std::false or&nbsp; std::intermediate.<br>&nbsp; bln =3D&nbsp; s_op=
..some_bool_function();&nbsp; // 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>&nbsp; <br><=
br>Thanks &amp; Regards,<br>--Jim Smith<br><br>E-mail: JimSmithEllis@Gmail.=
com<br><br>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; 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 />
&nbsp;<br />
&nbsp;<br />

------=_Part_2732_11362451.1372055749977--

.