Do you know any good resources/articles/examples of boost::fusion library usage?
Boost Fusion looks extremely interesting, I think I understand how it works and how to use the basics, but I'm looking for some resources that show any interesting usage/practices e.g. articles or blogs (apart from boost.org itself).
...
Hello all,
For a program of mine I made a small function to clear the various std::vectors of pointers that I have.
template <class S>
void clearPtrVector(std::vector<S*> &a,int size)
{
for(size_t i = 0; i < size; i++)
delete a[i];
a.clear();
}
I must have done something wrong here though since when calling this fun...
Hi there,
does anyone know how i can map EJS to visual studio to act like a HTML file. I think i managed to do it but its got a lot of bloat in it.. Its basically an HTML file without the HTML and BODY tags.. so i selected the UserControl in VS 2008, tools, options, Text Editor, file extension and added EJS and added it as usercontrol.
...
I'm trying to use templates to get std:list of items, where each item has a pointer to the list which contains it, but I keep hitting a compiler message.
Here's a very stripped down version of the code.
template <class E> class Item
{
public:
E* owner; // pointer to list that owns us.
};
template <class E> class BaseList: p...
In C++, I understand that it is possible to create a Singleton base class using templates. It is described in the book, Modern C++ Design, by Andrei Alexandrescu.
Can something like this be achieved in Java?
...
I have an application written in C++ (makes heavy use of templates) that I need to take to the Java ME platform.
I have two questions:
Are there any good tools to convert C++ code to Java - do some basic stuff so I have a platform to start with. I found this - http://tangiblesoftwaresolutions.com/Product_Details/CPlusPlus_to_Java_Conv...
I am trying to send mail using mail templates. To do this I want to load a .tpl into a variable. Instead of loading an HTML file and substituting placeholders, I wonder if it is possible to set values of the view in the controller, and then load this view into a variable. This way I would have a variable containing the HTML mail filled o...
I want to remove, if possible, the includes of both <vector> and <string> from my class header file. Both string and vector are return types of functions declared in the header file.
I was hoping I could do something like:
namespace std {
template <class T>
class vector;
}
And, declare the vector in the header and include it ...
Given: (Code reduced to a sensible minimum)
// MemberTypes
template
<
typename SPEEDTYPE = float,
typename SIZETYPE = float,
typename ACCELERATIONTYPE = float
>
struct ParticleMemberTypes
{
typedef typename SPEEDTYPE SpeedType;
typedef typename SIZETYPE SizeType;
typedef typename ACCELERATIONTYPE AccelerationType;
};
// ...
I would appreciate any help as C++ is not my primary language.
I have a template class that is derived in multiple libraries. I am trying to figure out a way to uniquely assign an id int to each derived class. I need to be able to do it from a static method though, ie.
template < class DERIVED >
class Foo
{
public:
static int s_id...
How does one modify the following code to allow template function ask_runUI() to use s_EOF without making s_EOF public?
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
class AskBase {
protected:
std::string m_prompt;
std::string m_answer;
virtual bool validate(std::string a_response) = 0;
public:
...
Hi, does anyone know of a syntax highlight for mako templates for eclipse or for textmate?
I know that there is a .mako syntax highlighter for the default text editor in ubuntu.
Thanks a lot.
Claudio.
...
I am trying to find a way of calling def templates determined by the data available in the context.
Edit: A simpler instance of the same question.
It is possible to emit the value of an object in the context:
# in python
ctx = Context(buffer, website='stackoverflow.com')
# in mako
<%def name="body()">
I visit ${website} all the time...
I am trying to implement a template which would allow to create a class derived from vector<> such that on deletion the element of the vector are deleted. The below snippet represents an attempt to do so:
include <vector>
using namespace std;
template <class P>
class TidyVector : public vector<P> {
public:
~TidyVector() {
while...
I'd like to set a variable in my Symfony action that holds the rendered template data for that action. I'm returning some JSON content with the action, and I'd like to store what the action would be outputting into the JSON and return it.
public function executeAjaxPriceAdditionCreate(sfWebRequest $request)
{
$this->form = new ProductP...
I wonder what is the C++ way of using dependency injection? Is that using templates or polymorphic classes? Consider the following code,
class AbstractReader
{
public:
virtual void Read() = 0;
};
class XMLReader : public AbstractReader
{
public:
void Read() { std::cout << "Reading with a XML reader" << std::endl; }
};
class TextF...
I'm a noob experimenting with templates and design patterns and would like to create an iterator pattern using a template argument ITEM. However, my private member var is a STL container that is itself a template, so how can I 'sync' the template argument of the STL container to that used by the class template?
Here is the actual cla...
i have seen many scripts where you'll see something like this
<meta keyword="{keywords}" ...>
or
<input type="text" name="name" value="{name}">
what is this called and how can i do this myself.
thanks
...
Our application makes use of C++ templates in a number of places. I am currently attempting to port from gcc 3.3.3 to 4.1.0 and am encountering issues. I have recreated the problem in a small shared library and executable. I am building the share library Ok, but the executable fails to link with the following:
undefined reference to...
I have a visitor class resembling this:
struct Visitor
{
template <typename T>
void operator()(T t)
{
...
}
void operator()(bool b)
{
...
}
};
Clearly, operator()(bool b) is intended to be a specialization of the preceding template function.
However, it doesn't have the template<> syntax ...