Vcsn  2.2
Be Rational
project-context.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/ctx/context.hh>
5 
6 namespace vcsn
7 {
8 
9  /*--------------------.
10  | project(context). |
11  `--------------------*/
12 
13  namespace detail
14  {
16  template <size_t Tape,
17  typename LabelSet, typename WeightSet>
19  -> std::enable_if_t<context<LabelSet, WeightSet>::is_lat,
21  {
22  static_assert(Tape < LabelSet::size(),
23  "project: tape index out of bounds");
24  return {ctx.labelset()->template set<Tape>(), *ctx.weightset()};
25  }
26 
29  template <size_t Tape,
30  typename LabelSet, typename WeightSet>
32  -> std::enable_if_t<!context<LabelSet, WeightSet>::is_lat,
34  {
35  static_assert(Tape == 0,
36  "project: cannot extract non-0 tape from a non tupleset"
37  " labelset");
38  return ctx;
39  }
40  }
41 }
auto project(const expressionset< Context > &rs)
Project an expressionset to one tape.
Definition: project.hh:40
Definition: a-star.hh:8
static dyn::context ctx(const driver &d)
Get the context of the driver.
Definition: parse.cc:82
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)