Introducing `variable_t` and similar types for convenience
- Langage dominant
- C++
- Étoiles
- 334
- Forks
- 76
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
@HDembinski Here are some examples why using `variable_t` can bring convenience.
```C++
std::is_same_v<
boost::histogram::axis::variable,
boost::histogram::axis::variable
>
```
is `false`,
```C++
std::is_same_v<
boost::histogram::axis::variable_t,
boost::histogram::axis::variable_t
>
```
is `true`;
---
This causes a compile error:
```C++
boost::histogram::axis::variable a;
boost::histogram::axis::variable b;
a = b;
```
This does not cause a compile error:
```C++
boost::histogram::axis::variable_t a;
boost::histogram::axis::variable_t b;
a = b;
```
---
In templates, you can get the meta type, options type, allocator type conveniently if template users write `variable_t`, not if template users write `variable`:
```
template
void f(boost::histogram::axis::variable)
{
std::cout << typeid(V).name() << '\n';
std::cout << typeid(M).name() << '\n';
std::cout << typeid(O).name() << '\n';
std::cout << typeid(A).name() << '\n';
}
int main(int argc, char *argv[])
{
f(boost::histogram::axis::variable<>());
//double
//struct boost::use_default
//struct boost::use_default
//class std::allocator
f(boost::histogram::axis::variable_t<>());
//double
//class std::basic_string,class std::allocator >
//struct boost::histogram::axis::option::bitset<3>
//class std::allocator
}
```
---
In debugger, you can not see what options `a` has but can see what options `b` has:

```C++
boost::histogram::axis::variable<> a;
boost::histogram::axis::variable_t<> b;
```
_Originally posted by @jhcarl0814 in https://github.com/boostorg/histogram/issues/372#issuecomment-1364494250_
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.