Skip to content

Commit

Permalink
Add countrOne function acting on types.
Browse files Browse the repository at this point in the history
  • Loading branch information
HaxyM authored Sep 6, 2024
1 parent 49baba6 commit 4abef6b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/crap/bit
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "bit.d/countlonevalue.h"
#include "bit.d/countlzerotype.h"
#include "bit.d/countlzerovalue.h"
#include "bit.d/countronetype.h"
#include "bit.d/countronevalue.h"
#include "bit.d/countrzerovalue.h"
#include "bit.d/hassinglebitvalue.h"
Expand Down
20 changes: 20 additions & 0 deletions include/crap/bit.d/countronetype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef CRAP_BIT_COUNTRONETYPE
#define CRAP_BIT_COUNTRONETYPE

#include "countronevalue.h"
#include "../utility.d/typeidentity.h"

#include <type_traits>

namespace crap
{
template <class Type> struct countrOneType;

template <class Type, Type Value> struct countrOneType<std :: integral_constant<Type, Value> >
: typeIdentity<std :: integral_constant<decltype(countrOneValue <Type, Value> :: value), countrOneValue <Type, Value> :: value> >
{};

template <class Type> using countrOneType_t = typename countrOneType <Type> :: type;
}
#endif

0 comments on commit 4abef6b

Please sign in to comment.