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 ...
2
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 ...
Springlet asked 2/10 at 6:53
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...
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...
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...
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...
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...
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....
Oxidate asked 18/7 at 21:12
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...
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...
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...
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?
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...
Saval asked 9/3, 2020 at 21:26
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
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>&...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.