Questions tagged [policy-based-design]

56 questions
0
votes
1 answer

Accessing static data through inheritance of a template template parameter?

template < template class storage_t, typename T, typename is_allocated > class Buffer : public storage_t { ... }; template < template class storage_t, …
0
votes
1 answer

Named, arbitrary size tuple in C++

I am creating a library to draw samples from a bayesian model, as a backend for an R package. Thing is, MCMC algorithms tend to give a difficult time debugging. Moreover, Rcpp does not have an easy way to debug; in practice I ended up with a massive…
0
votes
2 answers

C++ policy objects and the builder pattern

I have some class Builder which builds an Object. I have plans to replace some of the Object's guts with policy objects, for example being able to set some container type Storage. Specifically, I'd like to use the Builder to set policy objects of…
glfmn
  • 15
  • 4
0
votes
0 answers

Configuration of policy classes

I wonder what is the best practice to configure policies in policy based design. The interface of the policy is defined by its host class. Nevertheless, it is not defined how this interface needs to be implemented. Therefore, policies might need…
erikzenker
  • 752
  • 5
  • 18
0
votes
1 answer

Decoupling host and policy classes at the cost of stateful policy classes and not following Item 26 of Effective C++

This post consists of describing a problem with the straightforward implementation of the policy-based design, proposing an alternative implementation, analyzing the proposed implementation and asking help in giving correct weight to the different…
AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
0
votes
2 answers

C++ policy design with variable data

There's quite a bit of info on this topic. This is more of a design question, but I will give examples. Let's say that I literally want to pass around a profile class, that dictates policies of a user. struct ApplicationAllowedPolicy { public: …
kiss-o-matic
  • 1,111
  • 16
  • 32
0
votes
1 answer

Using Policy Based design C++

My present class design is something like this (I have replicated the class hierarchy and function calls.): Helper* HelperFactory::create(const Advice& advice, const Handler& ah) { Helper* result = 0; switch(advice.getType()) …
user1545583
  • 69
  • 1
  • 6
0
votes
2 answers

GCC doesn't see implementation through multiple inheritance

I'm trying to generalize my class using policy-based design, and it seems that gcc doesn't see the implementation of pure virtual functions that are implemented in base classes. Here is an example: #include template
0
votes
1 answer

How to share a member between policies?

Suppose I have a host class that holds a member: template struct host : public p1, public p2 { double member; }; and I want to use the same member in p1 and p2: struct p1 { void f1() { host::member+=1;} // this is incorrect…
kirill_igum
  • 3,953
  • 5
  • 47
  • 73
0
votes
1 answer

Policies interacting with one another in policy-based design

I'm trying to program a genetic algorithm for a project and am having difficulty keeping different functions separate. I've been reading up on policy-based design, and this seems like a solution to the problem, but I don't really understand how to…
user1535823
  • 125
  • 2
  • 8
-2
votes
1 answer

Policy based design in Python

I was very impressed by the policy based design described in Modern C++ Design by Andrei Alexandrescu and tried it successfully in some light weight programs. Now I have to write a real world system in Python and I think that approach would be very…
341008
  • 9,862
  • 11
  • 52
  • 84
1 2 3
4