Questions tagged [template-aliases]
67 questions
3
votes
1 answer
What's the formal of C++ const reference (not reference to const, but const reference)
Given
template< class Type >
void constref( Type const ) {}
void constref_call() { double x; constref( x ); } // OK
template< class Type >
using reference = Type&;
void foo( reference< const int > const x ) { (void) x; } //…

Cheers and hth. - Alf
- 142,714
- 15
- 209
- 331
3
votes
1 answer
how to use template alias to remove one unecessary parameter
I have this template class:
template
struct Builder
{
T operator()(const std::string& s) const { return F(s); }
typedef T type;
};
since I need a class holding a function and the value returned by the…

Ruggero Turra
- 16,929
- 16
- 85
- 141
3
votes
1 answer
Type alias / using declaration for iterator in C++11
I am having trouble getting a using declaration to work that I believe should work:
#include
#include
using namespace std;
template
vector find_all1(C& c, V v)
{
vector

Gabriel Perdue
- 1,553
- 2
- 15
- 23
3
votes
1 answer
Visual Studio 2013 template alias
The following code
template
using enable_if_integral_t = typename std::enable_if::value>::type;
template
class DigitsNumber;
template
class…

bolov
- 72,283
- 15
- 145
- 224
3
votes
1 answer
Compile error when using template aliases, inheriting template and using a "template parent's" types
I have a data container which has following requirements:
Be fast: Hence templates and not normal inheritance
Use different implementations
Be able to extend those implementations with more methods
Data is specified via template argument and needs…

UrOni
- 431
- 4
- 9
2
votes
1 answer
C++11 alias templates in CUDA
The essential question is are alias templates supported by the CUDA compiler?
I am using CUDA 7.5 on Ubuntu with gcc-4.8. All of my template classes are defined in header files and #included into a single translation unit during compilation.
I have…

Tim
- 1,517
- 1
- 9
- 15
2
votes
1 answer
Partial template binding, create new template as type
Is there some way to partially bind a template to parameter types? For example, I have the following template:
template struct generic { };
And I have another template which takes a template class as a parameter, expecting…

edA-qa mort-ora-y
- 30,295
- 39
- 137
- 267
1
vote
1 answer
Why is it not possible to use a template alias in function as parameter and to be automatically deduced?
I was trying to simplify a template function by using a template alias instead of the underlying type:
template,
typename Allocator = std::allocator,
typename String =…

Halim
- 13
- 3
1
vote
2 answers
Specialization of alias template best alternative without overhead in C++11
I am aware of the fact it is not possible to specialize an alias template.
The fact is that I often find the following recurring pattern:
template
struct BaseStruct;
enum MyCode {A,B,C};
template
using MyStruct…

svoltron
- 365
- 1
- 10
1
vote
1 answer
SFINAE to set alias template
I was wondering if it is possible to use SFINAE to set an alias template in a different class depending on the existence or not of an alias in a traits class.
template
struct Foo_Traits;
struct Foo1;
template<>
struct Foo_Traits
{
…

xerion
- 303
- 2
- 11
1
vote
1 answer
Matching template aliases as template template parameters
I'm currently writting a metafunction to evaluate expressions, something like boost::mpl::apply:
template
using eval = typename eval_impl::result;
As you can see, I'm using C++11 template…

Manu343726
- 13,969
- 4
- 40
- 75
1
vote
0 answers
c++11: Type transformation of an enum-class-type derivative via alias-template
Consider the following code, which compiles fine in clang but not in gcc (4.7.2):
template using remove_ref_typed =
typename std::remove_reference::type; // alias-template w/ 'typename'
template using remove_ref =
…

etherice
- 1,761
- 15
- 25
0
votes
1 answer
Compare templates itselves and not instantiated template-types
My goal is to be able to compare templates i.e. write something like this
template
struct template_type;
template typename TTmpl, typename ...Ts>
struct template_type> { using type = TTmpl; }; // [1]…

Dmitry Katkevich
- 883
- 7
- 26
0
votes
1 answer
Template template parameter and template alias: compiler bug?
I have got problem with the following representative sample code:
template
struct X {};
template
struct Y {};
template
struct XX: X {};
template
struct YY: Y {};
template class TP>
struct…

janou195
- 1,175
- 2
- 10
- 25
0
votes
0 answers
Trying to understand variable templates and template aliases for proper usage
I had previously asked these two questions:
Auto Type Deduction
Static & Non Static Member Functions
My question pertains to the class provided in the first question which is my Signal class.
The idea that I'm trying to convey within the class is…

Francis Cugler
- 7,788
- 2
- 28
- 59