templates

Overriding a templated class function

I'm trying to create some kind of callback for a class template. The code is like this: template <typename t> class Foo { void add(T *t) { prinf('do some template stuff'); on_added(t); } void on_added(T *t) { } } struct aaa {} class Bar : Foo<aaa> { void on_added(aaa *object) { printf("on added ...

do i need virtual destructor for boost::ublas matrix ?

do i need virtual destructor when iam using boost::ublas matrix ? btw my class is a template class ...

Sharepoint 2010: is it possible to extend an Fab40 site template?

I just tried using one of the fab40 templates... however, it doesn't do everything I would want so I would like to extend it. My guess is that since it is packaged up as an wsp, that this isn't possible without the source. I find it hard to believe that source would not be provided, am I not looking in the right place? ...

Templated << friend not working when in interrelationship with other templated union types.

While working on my basic vector library, I've been trying to use a nice syntax for swizzle-based printing. The problem occurs when attempting to print a swizzle of a different dimension than the vector in question. In GCC 4.0, I originally had the friend << overloaded functions (with a body, even though it duplicated code) for every dim...

Static data members of class templates

"A definition for a static data member may be provided in a namespace scope enclosing the definition of the static member's class template." It means ... Is this correct..... namespace N{ template<typename T>class A{ public: static int x; static int fun(); }; } namespace N1{ template<class T>int A<T>::x=10; } namespace N2{t...

forward declaration in c++

I want to forward declare: namespace boost { namespace property_tree { template<typename Key, typename Data, typename KeyCompare = std::less<Key> > class basic_ptree; typedef basic_ptree< std::string, std::string > ptree; } } but my g++ cribs about redefinition due to default template argument. How can ...

Compile-time 'String' Manipulation with Variadic Templates

Hey all, I'm currently trying to write a compile-time string encryption (using the words 'string' and 'encryption' quite loosely) lib. What I have so far is as follows: // Cacluate narrow string length at compile-time template <char... ArgsT> struct CountArgs { template <char... ArgsInnerT> struct Counter; template <char Cur, char.....

Member templates

Can any one explain this "A using-declaration in a derived class cannot refer to a specialization of a template conversion function in a base class." it is from ISO C++ Standard ..14.5.2 ,point 7 ...

Word Template, populate fields, C# .NET

Hello Everyone, I have a word document (docx format) that I need to populate with data from a dictionary . The key of the dict will be the word field to be populated. I was wondering what is the best way to do this (bookmarks, mail merge fields, etc)? I did a little work with Bookmarks, but I would like to be able to reuse some of the f...

How can I index a collection and allow each index's variable to have a custom setter?

So I have an object called Vertex which contains some parameters (let's call them sx, sy and i). sx, sy and i each have special setters: ie, Vertex looks something like class Vertex { public: float sx() { return sx; }; void setSx(float val) { val > 0 ? sx = val : sx = 0; }; float sy() {...

How can I properly use multidimensional dictionaries in Cheetah for Python?

I have the following dictionary: {0: {'Shortname': 'cabling', 'Name': 'CAT5 Cabling', 'MSRP': '$45.00'}, 1: {'Shortname': 'antenna', 'Name': 'Radio Antenna', 'MSRP': '$35.00'}} And using Cheetah, the following section of template: #for $item in $items <tr> <td>$item.Name</td> <td>$item.MSRP</td> </tr> #end for When I run the code, ...

When do we need a .template construct

I made the following program #include <iostream> #include <typeinfo> template<class T> struct Class { template<class U> void display(){ std::cout<<typeid(U).name()<<std::endl; return ; } }; template<class T,class U> void func(Class<T>k) { k.display<U>(); } int main() { Class<int> d; func<in...

Member templates ,Statemement From ISO C++ Standard?

can any one explain this? "Overload resolution and partial ordering are used to select the best conversion function among multiple template conversion functions and or non-template conversion functions." Please explain with a program..... the statement is from ISO C++ Standard 14.5.2 section ,point 8 ...

Elegant way to extract values from a string parsed with a template

Hello all, I have a template like this: foo_tmplte = Template("fieldname_${ln}_${type} = $value") and a lot of strings parsed with this template like this: foo_str1 = "fieldname_ru_ln = journal" foo_str2 = "fieldname_zh_TW_ln = journal" foo_str3 = "fieldname_uk_ln = номер запису" Now i want to extract back the variables from the t...

Gridview combine autogenerated fields and template fields

I have several sqldatasources for my gridview. All of the columns are autogenerated. However they all have some consistent fields and I'd like to make those fields template fields so I can modify the edit template for them such as adding a drop down menu. Is this possible? If so, how? :-D Thanks! ...

Does c++0x tuple use the new variadic templates or Boost's macro-fied tuple implementation?

I read it was based on Boost's version, but I wasn't quite sure what that meant when it came down to implementation. I know Boost does their own variadic template, but I would assume c++0x would use its own variadic templates for the new tuple. ...

What is the purpose of "typename" in C++

Possible Duplicate: Officially, what is typename for? When I use template <typename TMap> typename TMap::referent_type * func(TMap & map, typename TMap::key_type key) { ... } what is the purpose of the two "typename"'s on the second line? It seems to trigger a compile-time warning (VS2008: C4346) but it's only a "do you c...

Can StringTemplate iterate through 'values' in a String?

I have a String made up of several Strings seperated by commas. Using StringTemplate, is there an easy way to write a seperate line for each 'value' in this outer String? For example, I have: String layers = "ADM,NAV"; and I want to output: ADM,Y, NAV,Y, I suspect the template would look (if it's possible) something like this: $...

PHPDoc Template

Hi, I was wondering, if someone had a nice template (like the documentation on php.net) for PHPDoc... I don't like the standard templates and can't find new ones on google... I like php.net documentation, and was wondering if it was available for PHPDoc, or something similar (not the standard HTML:Smarty:PHP theme, I don't like that......

Does anyone know a good marquee/horizontally scrolling ticker for JQuery?

One that is identical to Twitter.com's horizontal scroller is perfect. ...