Hello all,
I have structure for storing callback function like this:
template<class T>
struct CommandGlobal : CommandBase
{
typedef boost::function<T ()> Command;
Command comm;
virtual T Execute() const
{
if(comm)
return comm();
return NULL;
}
};
Seems like it should work fine except w...
Situation
I want to implement the Composite pattern:
class Animal
{
public:
virtual void Run() = 0;
virtual void Eat(const std::string & food) = 0;
virtual ~Animal(){}
};
class Human : public Animal
{
public:
void Run(){ std::cout << "Hey Guys I'm Running!" << std::endl; }
void Eat(const std::string & food)
{
...
Should I scan for tags in the html code? Or what? What determines whether a page is optimized for mobile?
One option is to scan for tags. If so, what other tags are there?
<link rel="apple-touch-icon" href="..." />
<meta name="viewport" content="width=device-width, user-scalable=no" />
Another option is to see if the HTML returned fr...
Hi,
this is probably a useless problem but it stuck on my mind for few hours.
I wanna write a function which accepts some (POD) arguments, convert them to string and return the concatenation. for example
template<typename A, typename B>
string ToString(A a, B b)
{
stringstream ss;
ss << a << b;
return ss.str();
}
pretty ...
i have a problem with this class.
the goal is to make the main function work properly. we were supposed to implement the "And" function object so that the code will work. i can't find what is the problem with our solution. (the solution start and end are marked in comments in the code before the "main" function)
can you please help?
than...
Hello all
I am developing a webapp using Cakephp. I have created a default layout for the website. I created sections like header, footer, content.
Now some of the pages in my content section have same structure. These are part of a controller with various views defined for each page. What view template should I be using here? Layouts ...
I had this question asked of me on Monday and for the life of me I don't know how to answer. Since I don't know, I now want to very much find out. Curiosity is killing this cat. Given two integers, return the lesser at compile time.
template<int M, int N>
struct SmallerOfMandN{
//and magic happenes here
};
Got pointers or how t...
Possible Duplicates:
How can a Word document be created in C#?
Convert Word doc file to docx on a server without Word
Hi everyone !
Using your experiences, i wanna found the better sdk/library to create Word doc/docx, with or without .doc template, but without interop !
Thanks !
kiRbytte
...
I'm looking to buy professional looking site templates. I love coding but design is not my forte. I also am working on a site for my company and I'd like for my users to be able to log in and edit the content instead of me doing it for them (CMS?). Templates that work in php and asp.net are preferred.
Anyone have a best kept secret w...
Imagine I had a list of names, each paired with a value ("C" for CheckBox or "R" for RadioButton).
Can I put together a template to display the correct control based on the given value?
For instance if I have "Name0, C" I'd like to display a CheckBox labeled Name0.
If I have "Name1, R" I'd like to display a RadioButton labeled Name1.
...
Is the following valid?:
template<typename T> class C { C1<C2<T>> someMember; };
...
Guys, I'm doing excercises from "The C++ Programming Language 3rd ed." and on page 340 there is an example of function:
template <class T, class C = Cmp<T> > // Here is a default argument
// But as far as I'm concerned it's illegal to have a default argument in
// a function template
int compare (const String<T>& str1, const St...
What is dependent scope and what is the meaning of typename in the context of the following error?
$ make
g++ -std=gnu++0x main.cpp
main.cpp:18:10: error: need 'typename' before 'ptrModel<std::vector<Data> >::Type' because 'ptrModel<std::vector<Data> >' is a dependent scope
make: *** [all] Error 1
/*
* main.cpp
*/
#include <vector...
I am working in a very large legacy C++ code base which shall remain nameless. Being a legacy code base, it passes raw pointers around all over the place. But we are gradually trying to modernize it and so there are some smart pointer templates as well. These smart pointers (unlike, say, Boost's scoped_ptr) have an implicit conversion...
#include <list>
#include <boost/tuple/tuple.hpp>
template<class InputIterator>
void f(InputIterator it)
{
typedef boost::tuple<typename InputIterator::value_type, int> Pair;
std::list<Pair> paired;
typename std::list<Pair>::const_iterator output;
for(output=paired.begin(); output!=paired.end(); ++output)
{
ou...
I am preparing a sample by using OpenCV cvMatchTemplate(); function and I want to find all templates that's max. loc. upper than 0.40 with CV_TM_CCOEFF_NORMED method.
I mean I want to find all templates which match. I find only the best match template but I want to find all of them.
I hope I explained what I want.
Thanks.
...
I am struggling to understand why the initialization of pprocessor, below, is written like this:
class X
{
...
private:
boost::scoped_ptr<f_process> pprocessor_;
};
X:X()
: pprocessor_( f_process_factory<t_process>().make() ) //why the factory with template
{...}
instead of just writing
X:X()
: pprocessor_( new t_process() )
{...
I have created a template to use as team project portal template. However, when I try to create a project with portal from this template, I get an error message saying :
Module: WSS
Exception Message: TF249033: The site template is not available for the locale identifier (LCID). The site template name is: _GLOBAL_#0. The LCID is: 1033....
Currently I'm working with ASP.NET 2.0, which may explain why I'm not as up on this as I might be. However, I don't see a full solution in my Googling of ASP.NET MVC, etc.
Here's my background thinking.
Firstly, data-bound templates are really useful. I'm currently dealing with lots of legacy code whereby people are building up control...
Hi,
I'm trying to use qFromBigEndian to read a 32-bit int from a byte stream received over a udp socket.
void processData(uchar *data)
{
qint32 addr;
addr = qFromBigEndian(data);
}
Compiling this gives the following error:
error: invalid conversion from 'uchar*' to 'qint32'
The Qt documentation says:
T qFromBigEndian ( const...