i need an mpl::equal like procedure that supports recursion on types.
namespace mpl = boost::mpl;
BOOST_MPL_ASSERT(( mpl::equal<
mpl::vector<int, char>,
typename mpl::push_back<mpl::vector<int>, char>::type > )); // OK
the above compiles fine, however if i use it in mpl::transform or mpl::fold, visual studio 2010 rc1 complains.
...
Hi!
I'm implementing an event system for a game. It uses an event queue, and a data structure to hold all registered event handlers for a given event type. It works fine so far registering handlers, but when it comes to unregistering them (something that will take place when a game object is destroyed, for instance) I'm having a bit of ...
I'm looking for a minimalist template system for javascript, ala John Resig's Javascript Micro Templating. The smaller the better, and if it's jquery based even better. Recommendations?
I tried John's micro-templating but ran into a few issues, wanted to see if there are more baked / better packaged solutions out there.
[Update] I trie...
I just want that horizontal div (about 50 pixels tall) that span across the entire bottom of the page always. How?
...
I want to use this LazyLoad plugin for JQuery. http://www.appelsiini.net/projects/lazyload
But, they say this at the bottom of the page:
Due to webkit bug #6656 Lazy Loading
wont give you any improvements in
Safari. It will load all images you
wanted it or not.
It seems jQuery 1.3.x breaks the
plugin for IE. All images ...
I am currently using YUI datatable, but it is buggy: http://developer.yahoo.com/yui/datatable/
Is there another similar plugin that can do this , in JQuery?
...
I am creating a web application that will need to send a variety of emails out to users. Instead of hard-coding the contents of the email in the app, I want to use a template stored on disk and replace tokens in it (ex. "Hello, %%FirstName%%!") with the actual data. I have some experience with creating XSLT templates, but since the dat...
Imagine a control named Testko like this:
public class Testko: Control
{
public static readonly DependencyProperty TestValueProperty;
static Testko()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Testko), new FrameworkPropertyMetadata(typeof(Testko)));
TestValueProperty = Dependen...
The following code works with Visual Studio 2008 but not with GCC/G++ 4.3.4 20090804. Which behaviour is - according to the C++ standard - correct?
template <int N>
struct A : A<N-1> {};
template <>
struct A<0> {};
struct B : A<1> {};
template <int N>
void Func(const A<N> &a) {}
int main()
{
A<1> a; //is derived from A<0>
...
{% for p in profiles %}
<div class="result">
{{ p.first_name }}
</div>
{% endfor %}
Suppose I have 1000 of these, in a huge list.
How would I make this code appear every 15 times?
<div class="menu">abc</div>
...
In preparing to a OOP exam, I enjoyed seeing g++ compile the following code (without an instantiation) even though it appeared to make no sense:
template<class T> void f() {
T t = "a";
t += 5.6;
t->b();
T* p = t;
p = p*(t/"string");
}
I then set out on a challenge to make this instantiate and compile.
I created th...
Hi,
I have atleast 16 functions of the following form.
bool Node::some_walker( Arg* arg1 )
{
if(this == NULL)
return false;
bool shouldReturn = false;
if( this->some_walker_p(arg1, shouldReturn) ) //This line alone varies
return true;
if( shouldReturn ) // true is already returned
return fal...
I have a class that uses several policies that are templated. It is called Dish in the following example. I store many of these Dishes in a vector (using a pointer to simple base class), but then I'd like to extract and use them. But I don't know their exact types.
Here is the code; it's a bit long, but really simple:
#include <iostre...
A templated function gives me the convenience to operate on a variety of types:
template<typename T> void destroy(T* obj) {
delete obj;
}
But at some point I want to do some specialization on a class hierarchy:
class Base { virtual void doSomething(); };
class Derived : public Base {};
void destroy(Base* obj) {
obj->doSomethi...
Usually, when A is inheriting from B, all the members of A are automatically visible to B's functions, for example
class A {
protected:
int a;
};
class B : public A {
int getA() {return a;}
//no need to use A::a, it is automatically visible
};
However when I'm inheriting with templates, this code becomes illegal (at least...
I'd like everything to function correctly, except when it's mobile, the entire site will used a set of specific templates.
Also, I'd like to autodetect if it's mobile. If so, then use that set of templates throughout the entire site.
...
I'm trying to design a policy-based class, where a certain interface is implemented by the policy itself, so the class derives from the policy, which itself is a template (I got this kind of thinking from Alexandrescu's book):
#include <iostream>
#include <vector>
class TestInterface {
public:
virtual void test() = 0;
};
class TestI...
Has anyone implemented a good system for ensuring that output is properly HTML-encoded where it makes sense? Maybe even something that recognizes when output should be URL-encoded or JSON-encoded instead?
The lazy approach — just encoding all inputs — causes problems when you want to send those inputs to a database, or to a block of Jav...
I am passing variable to template in web.py and have the same condition in some places. Like this:
$if myvar=="string1":
$passed argument1
............
$if myvar =="striung2":
$passed argument2
If say myvar is "string1" and I pass passed = "AAA" then I have AAA argument1 on my page, but the other if statements get replaced by e...
Is it wise to have include guards around template classes?
Aren't template classes supposed to be reparsed each time you reference them with a different implementation?
N.B In Visual C++ 2008 I get no errors combining the two...
...