Questions tagged [boost-proto]

Boost.Proto is a framework for building Domain Specific Embedded Languages in C++. It provides tools for constructing, type-checking, transforming and executing expression templates.

Proto is a framework for building Domain Specific Embedded Languages in C++. It provides tools for constructing, type-checking, transforming and executing expression templates[2]. More specifically, Proto provides:

  • An expression tree data structure.
  • A mechanism for giving expressions additional behaviors and members.
  • Operator overloads for building the tree from an expression.
  • Utilities for defining the grammar to which an expression must conform.
  • An extensible mechanism for immediately executing an expression template.
  • An extensible set of tree transformations to apply to expression trees.

Boost.Proto Documentation can be found here

44 questions
1
vote
1 answer

How to make a boost-proto function expression streamable?

I'm going over the boost-proto tutorial, and ran into this problem with the lazy pow function example. This is the example code: // Define a pow_fun function object template // , typename Func> struct pow_fun { typedef double…
Irit Katriel
  • 3,534
  • 1
  • 16
  • 18
1
vote
0 answers

How to use boost::proto to connect slots to signals

I'm trying to create an embedded language to connect slots to member signals. I've looked at the examples and tutorials on the boost website but I'm still completely lost and I'm not even sure if what I want to do is possible. For example, if I have…
mousebyte
  • 61
  • 7
1
vote
0 answers

Evaluating proto expression tree

I am trying to evaluate a proto expression tree with a custom defined context. I have a struct exp_tag {} using which a create a terminal template inline typename proto::result_of::make_expr::type exp_t(T const &t)…
1
vote
1 answer

Matching operator somewhere in Proto expression

Why doesn't the following Boost.Proto grammar match dereference operator, and what's the correct way to do this? #include #include namespace proto = boost::proto; using proto::_; struct has_deref : proto::or_< …
Igor R.
  • 14,716
  • 2
  • 49
  • 83
1
vote
0 answers

Using a derived class as terminals in Boost.proto

Suppose you'd want to implement a simple EDSL (Embedded Domain Specific Language) with Boost.proto with the following requirements: Custom class 'Vector' as terminal Classes derived from 'Vector' are working terminals too, e.g. Vector10 Reading…
ritter
  • 7,447
  • 7
  • 51
  • 84
1
vote
1 answer

Boost.Proto: General class layout for an EDSL with custom terminal classes

In order to familiarize myself with Boost.Proto I am trying to build yet another expression template library for floating-point vectors of fixed but arbitrary size by adapting the TArray example from the user's guide. The first thing I do is to…
o.svensson
  • 329
  • 2
  • 9
1
vote
1 answer

Is it possible to build and incrementally evaluate/mutate expression trees in Boost.Proto?

Is it possible to extract parts of a Boost.Proto expression tree, evaluate them individually (externally), and then mutate the expression tree, replacing the extracted parts with a result? In my specific case, I'm trying to evaluate if I could…
meastp
  • 682
  • 1
  • 7
  • 15
1
vote
0 answers

How to parse DSL input to high performance expression template

(EDITED both title and main text and created a spin-off question that arose) For our application it would be ideal to parse a simple DSL of logical expressions. However the way I'd like to do this is to parse (at runtime) the input text which gives…
Benedict
  • 2,771
  • 20
  • 21
1
vote
1 answer

Obtaining the tag type of a Boost Proto child expression

Of a Boost Proto expression, when should I not expect a proto_tag member? I can enquire regarding the tag type of a placeholder, say, using either of the following methods: typedef proto::tag_of::type ta; typedef…
user2023370
  • 10,488
  • 6
  • 50
  • 83
1
vote
1 answer

Non-intrusively replacing a custom type with an expression tree

I'm trying to introduce lazy evaluation into an existing code project. The project core basically consists of a large amount of calculations using a custom type (it acts like a double but does additional work in the background). Our goal is to…
MatthiasB
  • 1,759
  • 8
  • 18
1
vote
1 answer

Displaying a Flattened Phoenix Expression using Boost Fusion

Following the Expressions as Fusion Sequences section of the Proto User Guide, I get to the point where I iterate over a flattened proto expression: _1 + 2 + 3 + 4: #include #include namespace proto =…
user2023370
  • 10,488
  • 6
  • 50
  • 83
1
vote
0 answers

User defined arguments in Boost Phoenix

The Boost Phoenix documentation here indicates that I can create my own (lambda) arguments instead of _1/arg1, _2,arg2 etc. So, starting with code like this: #include #include int main(int argc, char *argv[]) { …
user2023370
  • 10,488
  • 6
  • 50
  • 83
1
vote
1 answer

Non-default constructed boost::proto terminal

I'm trying to define a very limited parser combinator library using boost::proto and was wondering if it's by any means possible to define a non-default constructed proto terminal. I have a structure like this: struct symbol { symbol(const string…
Haitham Gad
  • 1,529
  • 2
  • 13
  • 23
0
votes
1 answer

Variable hiding within nested let blocks in Boost Phoenix

I'm having some trouble with nested let blocks in Boost Phoenix when an "inner" local variable hides an "outer" local variable. Even with the "Visibility" example from the documentation here, shown here: #include #include…
user2023370
  • 10,488
  • 6
  • 50
  • 83
1 2
3