Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add is_logic #192

Closed
gpeterhoff opened this issue Feb 4, 2024 · 2 comments
Closed

add is_logic #192

gpeterhoff opened this issue Feb 4, 2024 · 2 comments

Comments

@gpeterhoff
Copy link

What do I mean?
bool is always a logic type, of course. But there can be more logic types, e.g. boost::triboool.
is_logic must be adapted in the relevant libraries.
is_logic.hpp

//	Distributed under the Boost Software License Version 1.0 https://www.boost.org/LICENSE_1_0.txt
//	Copyright Gero Peterhoff

#ifndef BOOST_TYPE_TRAITS_IS_LOGIC_HPP
#define BOOST_TYPE_TRAITS_IS_LOGIC_HPP

#include <boost/type_traits/is_bool.hpp>
#include <type_traits>



namespace boost
{
template <typename Type>
struct is_logic : public integral_constant
<
	bool,
	is_bool<Type>::value
>	{};



#if !defined(BOOST_NO_CXX17_INLINE_VARIABLES)
template <typename Type> inline constexpr bool is_logic_v = is_logic<Type>::value;
#endif
}	//	boost

#endif	//	BOOST_TYPE_TRAITS_IS_LOGIC_HPP
@jzmaddock
Copy link
Collaborator

This is not what type_traits is for - we do not provide specialization points for other libraries, we introspect the type system, nothing more or less.

@gpeterhoff
Copy link
Author

gpeterhoff commented Feb 4, 2024

tribool is a component of boost. As I wrote, such libraries must of course set is_logic (to true) themselves. But first a basis has to be created to represent this.
As I wrote ages ago, I would like to provide classes for 4-value logic https://en.wikipedia.org/wiki/Many-valued_logic#Belnap_logic_(B4) and for 3-value logic (which could replace the old tribool).
These would of course contain an is_logic.
Now you have to decide:

  • is_logic is not implemented
    you are stuck with the stone old code (tribool), without the possibility to extend it
  • is_logic is implemented
    various logic classes can be categorized (there are even more than 2-, 3- and 4-value logics)

please open this issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants