The templates tag is used in multiple contexts: Generic programming, especially C++. Data or document generation using template engines. C++ templates Templates in C++ allow for generic programming and meta-programming. The C++ Book Guide contains books treating templates as well, especially: ...
2
votes
0answers
29 views
C++11: I can go from multiple args to tuple, but can I go from tuple to multiple args?
In C++11 templates, is there a way to use a tuple as the individual args of a (possibly template) function?
Example:
Let's say I have this function:
void foo(int a, int b)
{
}
And I have the tuple ...
0
votes
1answer
40 views
C++ matrix class template
I am coding a matrix template class and the problem I am having is that the array is created and the values are filled but when I use the print() function, the array is empty again. Could anyone ...
0
votes
1answer
37 views
Two template functions for two standard types
I'm trying to write two template functions. They must simply return reference to local variable. But it doesn't work:
class Cube_cache_value {
public:
//...
template<>
QVector<unsigned ...
0
votes
1answer
19 views
Templates and styles not applied on reload in JSF 2.0
I have just started using JSF 2.0 and faced a warmly welcomed issue.
I have used Templates and template client and applied CSS(should mention that I'm not a css expert) styles to the template file. ...
1
vote
1answer
33 views
C++ Template usage for statistical distribution types
This is a follow on from another question (http://stackoverflow.com/questions/10712659/c-class-design-for-monte-carlol-simulation)
I am planning on implementing a statistical distribution class, ...
2
votes
3answers
53 views
How to construct Foo<T> after receiving Foo<S>?
I have a class C which is templated on A<W> or on B<W>. Now in C, I'd like to construct an object of type A<U> or B<U>, depending on what it was instantiated with.
If that ...
0
votes
1answer
28 views
Get content between matching template tags
How can I get the contents from {@if condtwo} to the matching {!if}?
{@if condtwo}
{@if condone}
show this if condone is true
{!if}
other contents
{!if} <- matching {!if}
I tried ...
3
votes
2answers
59 views
C++ virtual method that takes STL-style iterators
I want to have an interface ModelGenerator which has a method generate() that takes an iterable list of Evidence and creates a Model. Using the STL pseudo-duck-typing iterator idiom...
...
1
vote
0answers
46 views
Abstracting over types of non-type template parameters
I would like to write a template that can deconstruct a type into a template with non-type template parameters along with its non-type template arguments. E.g., it would deconstruct Array<5> ...
4
votes
1answer
74 views
Template (C++) - not sure if correct
I'm a student and I'm doing a static library for arrays in C++, so I don't have to rewrite code every time during lessons.
I'm at second year in a secondary school so I'm not an expert.
I want my ...
1
vote
2answers
55 views
Template class inheritance
I have a problem with the following piece of code (it is a very simplified example that reproduce the error in my program) :
#include <iostream>
using namespace std;
template<class T> ...
-4
votes
0answers
26 views
Error in class template [closed]
If while defining the object of a template class,the type of argument specified is different from that type of value passed by the user,then runtime error is reported.
AFAIK templates support compile ...
7
votes
1answer
73 views
Can a template parameter's default argument be specialized?
In C++, if I have a template parameter, how can I cleanly specialize a default argument? For example, consider the following:
template <class Key, class Value = int > class Association;
What ...
1
vote
2answers
35 views
Compilation error in linked list iterator template
I am new to C++ templates. I get an error while compiling:
main.cpp(17) : error C2923: 'Iterator' :
'myWords' is not a valid template type argument for parameter 'T'
main.cpp(17) : error C2133: ...
0
votes
1answer
18 views
Binding to viewmodel's property from a template
I made a view for my GameViewModel
I have some xaml like that
<UserControl.Resources>
<DataTemplate DataType="{x:Type ViewModels:PlayerViewModel}">
<StackPanel>
...