With this code (just a class of test):
typedef unsigned short UInt16;
template<class T>
class CClass
{
public:
SValue* getNewSValue(void);
private:
typedef struct {
T *mValue;
T *next;
T *previous;
UInt16 index;
} SValue;
};
template<typename T>
SValue* CClass<T>::getNewSValue(void)
{
re...
Hello,
I am quite new to real use of templates, so I have the following design question.
I am designing classes Bunch2d and Bunch4d that derive from a abstract base class Bunch:
class Bunch {virtual void create()=0;};
class Bunch2d : public Bunch {void create();};
class Bunch4d : public Bunch {void create();};
The class Bunch will c...
Hello
According to
http://stackoverflow.com/questions/115703/storing-c-template-function-definitions-in-a-cpp-file
it is easy to seprate the interface and the implementation of a template class,
.h file
template<typename T>
class foo
{
public:
foo();
~foo();
void do(const T& t);
};
.cpp file
template <ty...
Hi there!
This question might be theoretical but i think some of the cases it makes sense.
I am just wondering about which solution is the most efficient: loading HTML templates or build up them with DOM functions?
Both has pros/cons and there's a lot of other factors that can close off any of them: For example it's obvious that DOM-co...
I try to implement a template class which requires to have a signal member that depends on the template argument. My first idea was to realize it like the following:
template<class T>
class SignalClass
{
typedef boost::signals2::signal<void (T &)> OnReceive;
public:
SignalClass(const OnReceive::slot_type &_slot)
{
m...
I'm having some problems on returning the parameter of a method as a template, look:
// CTestClass.h
template<class T>
class CTestClass
{
public:
T getNewValue();
};
// CTestClass.cpp
template<class T>
T CTestClass<T>::getNewValue()
{
return 10; // just for tests I'm returning hard coded 10
}
// main.cpp
int _tmain(int argc...
I am working on a Drupal 6 site and need to create a Book where each book page has the same basic structure. I'd like to use a shared template.
Is there a Drupal module that allows me to create book pages from a shared template?
...
Is there any little (1-2 .pm's) parser based around XML::* and suitable for replacing CGI.pm's constructions like:
foreach($xmlnodes) {
print table( TR( td( $_) ) ); }
with node2html($node,$rules)?
I ain't going to fire up XSLT.
...
In the Django framework, web page templates can inherit from other templates. In your child template, you define blocks of code which override like-named blocks in parent templates. I'm guessing there are other back-end templating systems which also work this way, but Django is the one I'm familiar with.
Do any of the existing javascrip...
Hi friends,
I'm a EE newbie. I have a template for subpage. all subpages use same subpage template. But for some sub pages I need to put an extra div (kinda info box), how can I put a condition? do I have to create a separate template only for a small div difference?
urls are consistent, so if i can make a url check and display div fo...
Rephrased Question
I found that my original question wasn't clear enough and the repliers misunderstood my problem. So let me try to clarify:
Let's say I have two classes:
struct C { void(*m_func)(C*); };
struct D { std::function<void(D*)> m_func; };
Now I want to make a generic version of the two, so I do something like this:
temp...
And which templating library should new beginner user?
Not sure if OS matter,I'm talking about windows if that matters.
...
Could someone explain me why this code:
class safe_bool_base
{ //13
protected:
typedef void (safe_bool_base::*bool_type)() const;
void this_type_does_not_support_comparisons() const {} //18
safe_bool_base() {}
safe_bool_base(const safe_bool_base&) {}
safe_bool_base& operator=(const safe_boo...
I was looking for an object formatter and templater.
http://haacked.com/archive/2009/01/14/named-formats-redux.aspx
I looked into HenriFormatter and when check performance found that for the same object Type first invocation - causes 15x more time than for next - 15k ticks, second was around 1k. I become digg, and found that its using ...
Using django-tinymce I have successfully embedded TinyMCE in the Admin before. Embedding it in a front-end form does not seem to work for me however.
I have a form which is a modelForm. It doesn't add any extra fields ('comment' and 'statement' are the only fields used and they exist in the model). On the textarea field, 'comment', of t...
Hi,
I'm trying to create a simple qDebug-like class I can use to output debug messages in debug mode, dependant on some debug level passed when calling the app. I liked the ease of use of the QDebug class (which could be used as a std::cerr and would disappear when compiling in release mode). I have this so far:
#ifdef DEBUG
static...
I'm cooking up a vector library and have hit a snag. I want to allow recursive vectors (i.e. vec<H,vec<W,T> >) so I'd like my "min" and other functions to be recursive as well. Here's what I have:
template<typename T>
inline T min(const T& k1, const T& k2) {
return k1 < k2 ? k1 : k2;
}
template<int N, typename T, typename VT1, typename...
I'm trying to figure out why this example doesn't compile. My understanding is that if a static variable is not explicitly set then it defaults to 0. In the five examples below four of them behave as I would expect, but the one that's commented out won't compile.
#include <iostream>
class Foo
{
public:
static int i;
static int ...
A function template can be overloaded with other function templates and with normal (non-template) functions. A normal function is not related to a function template(i.e., it is never considered to be a specialization), even if it has the same name and the type as a potentially generated function template specialization.
This is the...
Hi,
Would it be a good idea, and executable, to use the ASP.NET MVC View Engine to render html to be sent out by email?
I know it's possible to let the view render into a string. So that could be use to build the mail message.
Since ASP.NET MVC is already used in the application, I get to use all practical ASP.NET MVC stuff without hav...