templates Questions

7

Solved

I'm trying to make a list of template classes of variable types. So the idea is to loop of a list of objects that all have a common function, e.g. getValue, but a different type. The type could be ...
Mccaskill asked 3/8, 2014 at 18:33

2

I intend for my question to be a follow up to: How do we use void_t for SFINAE?. I understand how void_t is used. I do not understand why it is necessary. Let's take the example from that SO questi...
Apicella asked 6/10 at 17:50

2

Solved

In this example code, why isn't using IParameterBase<TYPE>::operator=; working, and the base class assignment operator working? I recently changed to this templated version, previously I had ...
Lucifer asked 3/10 at 11:39

1

Solved

Consider this code (godbolt): #include <iostream> template<typename F> void call_by_val(F funct) { std::cout << "call_by_val(): "; funct(); } template<typename ...

2

Solved

Im trying to make a bot for a game. Basically it picks up items from the ground, thing is these items look different sometimes for ex. the angle is different or they are lying on differentyl colour...
Listless asked 19/6, 2019 at 11:53

2

Solved

I know how to write something up but i am sure there is a standard way of passing in something like func<TheType*>() and using template magic to extract TheType for use in your code (maybe Th...
Strepitous asked 2/6, 2011 at 18:37

5

I need to create a word document from a word template, its something like, we need to replace the few strings (say variables) in the template with the values. Please tell how we can do this in PHP...
Kief asked 4/1, 2010 at 17:23

3

Solved

I want to create a javascript object from a template. The problem is I don't know what the template is going to look like beforehand. As a simple example, if I had the template function template =...
Gavrila asked 21/4, 2014 at 9:15

3

Solved

I'm trying to return an int64_t if std::is_integral<>::value is true. Otherwise, I would like to call to_int64t() on the object. My attempt below is failing because partial specialisation o...
Angeli asked 24/3, 2013 at 13:19

4

I am trying for template inheritance from base.html to other templates using handlebars.But am not getting soul for this. Please, Can anyone help me out with simple DEMO. with base.html , extend....
Laurence asked 5/11, 2012 at 6:19

1

I am familiar with how to specialize std::formatter; it's relatively easy and clear with explicit specialization. But with partial specialization - its a challenge - due to shifting nature of vario...
Esmeralda asked 21/7 at 1:28

0

I am working on a high-performance sorting algorithm to sort hundreds of millions of uint64_t data. To improve efficiency, I want to use parallel execution with the x86simdsort library. I can provi...
Shoemaker asked 7/8 at 12:28

3

Solved

What I mean is, for example, a constructor for a class like the following: class vector<size_t N, typename FLOAT=double> { vector(FLOAT ...x) {} // I want exactly N arguments here }; I ho...
Basel asked 16/2, 2018 at 0:31

4

Solved

How can I obtain the tuple type of the first elements in a given tuple type? If I only ask for one element, it should give me the inner type instead of a tuple type of one element. In code, how w...
Doublecheck asked 6/7, 2013 at 23:52

1

The code below behaves incorrectly. When f<0> or f<5> is called, it prints as if k = true, but the if statement behaves as if k = false. When f<1> is called, it does the opposite....

4

Solved

a template parameter can be used in another template parameter that follows it this way : template<typename T, T N> struct s { }; But is it possible to reference "T" if it is declared afte...
Influx asked 18/9, 2009 at 22:48

4

Solved

I want to test a template class with gtest. I read about TYPED_TESTs in gtest manual and looked at the official example (samples\sample6_unittest.cc) they reference. This template from the example ...
Henshaw asked 1/4, 2015 at 3:1

3

Solved

Is it possible to include snippets of shared HTML using Vite (vanilla)? I'm looking for a way to have the HTML prerendered without injecting via JS. Something like: <html> <head> { in...
Chirpy asked 23/1, 2022 at 1:44

5

Solved

Can someone help me with this issue: I have a Django porject, in settings.py MEDIA_ROOT = 'C:/Users/hl/workspace/beer/media' MEDIA_URL = '/media/' STATICFILES_DIRS = ( 'C:/Users/hl/workspace...
Gustafsson asked 2/3, 2013 at 13:31

3

Solved

I'm writing different sort functions, which take two iterators and sort sequence. I would like to implement them for any kind of vector and make them typesafe, like this: template <typename T&g...
Scutter asked 24/2, 2016 at 12:33

5

How to check if a template argument is a std::vector<T>::iterator? For void type, we have std::is_void. Is there something like that for std::vector<T>::iterator?
Kandacekandahar asked 9/11, 2016 at 17:7

3

Solved

Given I have a template setup to do something on a type such as... template<typename T> class SimpleTemplate { private: T m_obj; public: void operator()() { m_obj.DoSomething(); } }; And...

10

Solved

I would like to write a template that will determine if a type is an stl container at compile time.   I've got the following bit of code: struct is_cont{}; struct not_cont{}; template ...
Rubbery asked 23/2, 2012 at 4:51

23

I'm trying to ask the user to enter numbers that will be pushed into a vector, then using a function call to count these numbers. why is this not working? I'm only able to count the first number. t...
Domitian asked 4/12, 2011 at 18:43

10

Solved

Consider the following: (Wandbox) #include <array> #include <algorithm> #include <iostream> template<typename T, int N, int M> auto concat(const std::array<T, N>&amp...
Caxton asked 12/3, 2017 at 15:9

© 2022 - 2024 — McMap. All rights reserved.