Vcsn
2.8
Be Rational
project-context.hh
Go to the documentation of this file.
1
#pragma once
2
3
#include <
vcsn/ctx/context.hh
>
4
#include <
vcsn/labelset/tupleset.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
>
18
auto
project
(
const
context<LabelSet, WeightSet>
&
ctx
)
19
-> std::enable_if_t<is_multitape<LabelSet>{},
20
project_context<Tape, context<LabelSet, WeightSet>
>>
21
{
22
// FIXME: The following assert works only for tupleset. Handle
23
// the case of expressionset.
24
//
25
// static_assert(Tape < LabelSet::size(),
26
// "project: tape index out of bounds");
27
return
{
ctx
.labelset()->template project<Tape>(), *
ctx
.weightset()};
28
}
29
32
template
<
size_t
Tape,
33
typename
LabelSet,
typename
WeightSet
>
34
auto
project
(
const
context<LabelSet, WeightSet>
&
ctx
)
35
-> std::enable_if_t<!is_multitape<LabelSet>{},
36
context<LabelSet, WeightSet>
>
37
{
38
static_assert(Tape == 0,
39
"project: cannot extract non-0 tape from a non tupleset"
40
" labelset"
);
41
return
ctx
;
42
}
43
}
44
}
WeightSet
tupleset.hh
vcsn
Definition:
a-star.hh:8
vcsn::detail::project
auto project(const expressionset< Context > &rs)
Project an expressionset to one tape.
Definition:
project.hh:40
context.hh
vcsn::context
Definition:
context.hh:19
vcsn::detail::ctx
return ctx
Definition:
project-context.hh:41
vcsn
ctx
project-context.hh
Generated by
1.8.13