Example, I want to specialize a class to have a member variable that is an stl container, say a vector or a list, so I need something like:
template <class CollectionType, class ItemType>
class Test
{
public:
CollectionType<ItemType> m_collection;
};
So I can do:
Test t = Test<vector, int>();
t.m_collection<vector<int>> = vector...
In my epic quest of making C++ do things it shouldn't, I am trying to put together a compile time generated class.
Based on a preprocessor definition, such as (rough concept)
CLASS_BEGIN(Name)
RECORD(xyz)
RECORD(abc)
RECORD_GROUP(GroupName)
RECORD_GROUP_RECORD(foo)
RECORD_GROUP_RECORD(bar)
END...
I have something like this:
class Base
{
public:
static int Lolz()
{
return 0;
}
};
class Child : public Base
{
public:
int nothing;
};
template <typename T>
int Produce()
{
return T::Lolz();
}
and
Produce<Base>();
Produce<Child>();
both return 0, which is of course correct, but unwanted. Is there anyw...
How do I turn the site I just made (html+css) into a template? I want to be able to have one master template to use for all the pages on my site like I am able to do in dreamweaver, can I do stuff like that outside of DW? I am kinda sorta new to this....
...
Hi, I need some help with creating a regex for my php script. Basically, I have an associative array containing my data, and I want to use preg_replace to replace some place-holders with real data. The input would be something like this:
<td>{{address}}</td><td>{{fixDate}}</td><td>{{measureDate}}</td><td>{{builder}}</td>
I don't wan...
I have the following template String: "Hello [Name] Please find attached [Invoice Number] which is due on [Due Date]".
I also have String variables for name, invoice number and due date - what's the best way to replace the tokens in the template with the variables?
(Note that if a variable happens to contain a token it should NOT be ...
I get the following error in Visual Studio 2008: error C2248: 'Town::Town' : cannot access private member declared in class 'Town'. It looks like the constructor is unable to access the members of its own class. Any idea what's going on?
Here's the code:
I have this:
template<class T> class Tree{...}
And this class:
class Town{
...
Hi all, I was recently trying to gauge my operator overloading/template abilities and as a small test, created the Container class below. While this code compiles fine and works correctly under MSVC 2008 (displays 11), both MinGW/GCC and Comeau choke on the operator+ overload. As I trust them more than MSVC, I'm trying to figure out what...
Hi
I have previously created a couple of page layouts in SharePoint designer and used these throughout a site collection. Everythings was fine. When choosing create page, I would be able to choose the from the following templates:
(WCM Page)Stock Control Page
(WCM Page)Sub Site Home Page
Now in addtion some mysterious page layouts ha...
In my ListView I want to use a property of the Container in an if statement on the aspx page as shown below. But I'm getting a "The name 'Container' does not exist in the current context" error. Can I not the Container in an if statement?
<ItemTemplate>
<tr>
<td>
<% if (EDIT_INDEX == (((ListViewItem)C...
I working on a small page content manager. I would like to create some variables like @contact@ that an user can add within some pages.
the @contact@ is a userControl (a contact form).
All the pages are stored as txt files.
My question is :
Is it possible to "translate" the @contact@ variable into the userControl when I "display" the ...
I have a Lotus Notes application which actually consists of a template with all the required forms, views and agents needed. It also requires some design elements (a custom form and a view for our own type of documents) from this template to be copied over to the mail template, so after the regular refresh all users have it.
The applica...
I define a template function which loads a map from a CSV file:
template <class T>
bool loadCSV (QString filename, map<T,int> &mapping){
// function here
}
I then try to use it:
map<int, int> bw;
loadCSV<int>((const QString)"mycsv.csv",&bw);
But get htis compile time error:
error: no matching function for call to
‘loadCSV(con...
Hi,
I am using C++ and I am trying to create a templated class (a Stack).
I would like to define the copy constructor and the assignment operator.
There are defined in the header and then I implement them in the cpp file.
Here are the problems I get:
- For the copy constructor:
prototype for ‘Stack::Stack(const Stack&)’ does not m...
I'm going to extend the existing std::map class and add a new function to it:
template<typename key_type, typename value_type>
class CleanableMap : public Cleanable, public std::map<key_type, value_type>
{
CleanableMap(const CleanableMap& in); //not implemented
CleanableMap& operator=(const CleanableMap& in); //not implemented
...
Hi,
i have two PHP files:
template.php
template.html.php
The first is the class definition for Template. The second contains an actual HTML-based template, however with PHP constructs (hence the .PHP extension). I'd call this a hybrid html/php file.
Is it possible to create some function in the Template-class (special_in...
How to add filter to the fileupload control in asp.net? I want a filter for Word Template File (.dot).
...
Hello Group,
I read sometime back (probably on c.l.c++.moderated) that virtual function calls can be templatized. I tried something on the following lines.
#include <iostream>
template<class T, class FUN>
void callVirtual(T& t, FUN f){
(*t.*f)();
}
struct Base{
virtual ~Base(){}
virtual void sayHi()=0;
};
struct D...
I've recently had an upswing in the number of people looking for web applications that look good too. I'm not much of a design guy though.
I need a tool that isn't as complex as Photoshop or Stylevision but will still help me to create a nice clean web UI (like stackoverflow for example) that can be then be integrated into a ASP.NET ma...
What would be the best way to put an image map in a joomla site? Would it be good to make it part of the template or to make it as an article?
...