Edit: I've edited the sample to better resemble the problem I have, now the function depends on a regular parameter (and not only on template parameters) which means that the computations can't be made at compile time.
I wrote some code with a hand written typelist and now we've started using boost and I'm trying to move it to the mp...
I have a templated class
template<class U, class V, class W>
class S
{
//... implementations
};
and some stock type implementations for type U, V and W:
typedef boost::mpl::vector<U0, U1> u_types;
typedef boost::mpl::vector<V0, V1, V2, V3, V4> u_types;
typedef boost::mpl::vector<W0, W1, W2, W3, W4> w_types;
I want to test class S...
Using boost::mpl, I can create a typedef of a three element vector like follows:
typedef boost::mpl::vector_c<int,1,2,3> height_t;
I can pull the values out of this typedef with the following snippit:
std::vector<int> height;
boost::mpl::for_each<height_t>(boost::bind(&std::vector<int>::push_back, &height, _1));
assert(height[0] ...
There are a couple of threads talking about license issue. Mostly focusing on GPL/LGPL/BSD. I am trying to use RabbitMQ in commercial applications, which is licensed under Mozilla Public License(MPL). Is MPL friendly to commercial use?
I found a different thread in stackoverflow, one of the comments mentions: MPL: people can take your c...
We use boost - so using that library should be fine.
But I've never managed to wrap my head around creating a set of templates which give you the right specialization for a whole class of data types, as opposed to specializing for a single data type (which I know how to do).
Let me go for an example to try to bring this down to earth. ...
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.
...
I'm developing a commercial silverlight application using some third party libraries that are published under Microsoft Public License (MPL).
I have to include the license text into my product which is somewhat strange in an silverlight application. In a normal desktop application I would just include the license als a .txt but I've no ...
I am trying to embed a Javascript engine into my application. But the license for Mozilla Javascript engine is GNU/GPL/MPL based and I don't have the time and energy to digest the cryptic legal document.
In short, does the license mean I need to publish my application's source code if I embed the engine into my own appli.? Something I...
I was having a look at the "Function" class documentation in Boost, and stumbled across this:
boost::function<float (int x, int y)> f;
I must admit this syntax is highly confusing for me. How can this be legal C++ ?
Is there any trick under the hood ? Is this syntax documented anywhere?
...
Please consider this -probably poorly written- example :
class Command;
class Command : public boost::enable_shared_from_this<Command>
{
public :
void execute()
{
executeImpl();
// then do some stuff which is common to all commands ...
}
// Much more stuff ...
private:
virtual void e...
Hi all!
example:
template<typename T>
struct type_of {
typedef boost::mpl::if_<boost::is_pointer<T>,
typename boost::remove_pointer<T>::type,
T
>::type type;
};
int main() {
int* ip;
type_of<ip>::type iv = 3; // error: 'ip' cannot appear in a constant-expression
}
thenks!
...
Hello!
I know that boost::variant uses boost::mpl stuff behind it and has a mpl-compatible typedef types.
Let's say I have a simple typedef: typedef boost::variant<bool, int> Variant;
Now I have another template function, let's say:
template <typename T> T function() {
// ...
}
I want this function to act differently for two ca...
Hi,
I started to play around with the boost fusion and mpl library and got stuck with a quite simple problem.
I declared the following types:
typedef boost::mpl::vector<char, int, long> TypeVector;
typedef boost::fusion::vector<char, int, long> FusionVector_t;
Now I wanted to write a function that gets me the value from the Fusion...
Hello!
Is is possible to make compilation-time Type -> Enum Series mapping?
Illustrating with an example:
Let's say, I have some Type and a enumerated value:
typedef int Type;
enum Enumerated { Enum1, Enum2, Enum3, Enum4 };
and now I somehow state the following: "let's associate Enum1 and Enum4
with type Type (don't know how to im...
Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector, but this requires a functor with a template function declared like the following:
template<typename T> void operator()(T&){T::staticCall();}
My problem with this is that I don't want the object T to be instantiated by for_each<>. I don't need the T parame...