Hi All,
I'm trying to implement a function that allows me to make a call like this
// veca is a vector of tuples in my case
columnViewOfTuple<0>(veca);
I implemented such function as follows
template<int N>
struct myfunction {
template<typename T, typename R>
std::vector<R> operator() (T& container)
{
std::vector<...
I'm trying to implement a function that allows me to make a call like this
// vec5 is a vector of tuples in my case
// some code that to declare and fill vec5
columnViewOfTuple<0>(vec5);
I implemented such function as follows
template<int N>
struct myfunction {
template<typename T, typename R>
std::vector<R> opera...
hi i am using localhost wamp server and i want to add smarty to it how can i do that
and is there any tutorial or ebook i should start with
thanks
...
As i understood, template value need to be known in compilation time.
so i write a little example just to see that i get it, but apperantly i didn't.
so i get this:
`defValue' cannot appear in a constant-
expression
can anyone please what is the problem and how it can be fixed?
#include <iostream>
template <class T,T defaultVal, int...
I'm looking for a Joomla or Drupal software product site theme(preferably Drupal and free)? I have no problem if the theme needs some css hacking. Any suggestions?
Thanks
...
Why compiler cannot specialize this function and is there a way to force him to do so?
The error I'm getting:
Error 1 error C2893: Failed to specialize function template ''unknown-type' Ternary::check(bool,Left,Right)'
#include "stdafx.h"
#include <iostream>
#include <string>
using std::cout;
using std::string;
template<int v>
stru...
Hello, I've some problem with using templates:
myclass.h
#ifndef MYCLASS_H
#define MYCLASS_H
class myclass
{
private:
public:
~myclass();
myclass();
template<class S>
void login(S login, S pass);
};
#endif // MYCLASS_H
myclass.cpp
#include "myclass.h"
#include "../additional_func.h" // for connect(QString,QS...
Is it possible to return type of an object? For example I would like to have construct like this:
//pseudocode
template<class T>
void f(int value)
{
//depends on type T different action can be taken
}
template<class T>
type getType(T obj)
{
return (type of obj);
}
and then in main:
f<getType(Object)>(value); ...
template <typename T>
void foo(int i)
{
//nothing inside
}
int main()
{
foo(5); //fails
foo<int>(5); //works
}
Why does foo(5) fail but foo< int >(5) work?
...
Possible Duplicate:
Why can templates only be implemented in the header file?
hello everyone I've just read that if I write some template I must write all code in header file (including constructor, desctructors...), but I can't understand why, can somebody please explain?
...
I get no matching member function error when i try to compile this code on my mingw32 compiler
#include <iostream>
using std::cout;
template <class T>
class Pattern
{
public:
Pattern(): element(){
cout<< "default c-tor";
}
Pattern(Pattern ©): element(copy.element){
cout<< "copy c-tor";
}
...
Hi,
I have a template class that I m trying to explicitly instantiate:
template<T>
struct tmat2x3
{
...
typedef tvec3<T> col_type;
..
};
the operator is declared as follows:
template <typename T>
typename tmat2x3<T>::row_type operator* (tmat2x4<T> const & m, typename tmat2x3<T>::col_type const & v);
I am explicitly instantiating t...
In one of my wordpress templates, the content code seems to keep the subpage menu from displaying in the sidebar. When ever I remove all code from the content div, the subpage menu appears as expected.
Could anyone point out where the code goes wrong?
Any help would be greatly appreciated!
<div id="content">
<div class="page...
Hello,
I am working on e-mail template
Code is something like this :
<table width="702" cellpadding="0" cellspacing="0" align="center" id="template">
<tr>
<td align="left" valign="top">
<img src="/email/new/top_bar.png" width="702" height="11" alt="" border="0">
<img src="/email/new/bottom_bar.png" width="702" height="11" alt="" bord...
My code is as follows
template <typename T>
class name
{
public:
name() : h_(0){}
template <typename U>
operator name<U>()
{
name<U> u;
u.h_ = h_;
return u;
}
private:
int h_;
};
int main(void)
{
name<int> a;
name<double> b = a;
return 0;
}
The error that I get is int name...
Purpose and craziness aside, is there a way to achieve this in C++?
template <typename P>
void Q void_cast(P Q *p) const
{
return static_cast<P Q *>(p);
}
I'm effectively trying to cast a pointer to a void pointer type whilst keeping any const, restrict and other qualifiers (denoted by Q).
I was under the impression there was stu...
if i have a template function:
template<class T, class S>
void foo(T t, S s){..//do something//}
and then, inside the main i do this:
string str = "something";
char* ch = "somthingelse";
double num = 1.5;
foo(ch, num);
foo(num, ch);
foo(str, num);
..
my question is in the compilation what code will be written at the executable?
is ...
I found myself repeat on the same structure over and over again in all new projects. Is there a tool that I can use to create my own initial template?
...
Hmm... Title is a bit of a mouthful, but I'm really not sure which part of this is causing issues, I've run through it a ton of times, and can't pinpoint why...
The idea is for a single Choice instance to be able to store any one value of any
of the types passed in to it's template list... It's kind of like a union, except
it keeps trac...
I am a "C" programmer that knows just the tiniest bits of C++. I am having a look at some open source C++ code trying to understand some things that it is doing. I can work out most of it but sometimes there is syntax I don't recognise and I'd like to be able to "look up" the meaning of the syntax so I can read just enough to understand ...