Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MODMED
modmedLog
Commits
462cd303
Commit
462cd303
authored
Jul 20, 2018
by
EXT Arnaud Clère
Browse files
Fixed build prb with QBind<_,Val<_>> (added move, maybe add && instead)
parent
079bfb77
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/QBind/QBind_impl.h
View file @
462cd303
...
...
@@ -95,7 +95,7 @@ struct QBind { static TResult bind(Val<TResult> value, T t) {
}};
// NB: QBind has a structure similar to a Traversable : https://wiki.haskell.org/Typeclassopedia#Traversable
// A QTraverse<Val<TResult>
>
,T> would be equivalent but would not mandate to actually traverse T to get from Val<TResult> to the actual TResult
// A QTraverse<Val<TResult>,T> would be equivalent but would not mandate to actually traverse T to get from Val<TResult> to the actual TResult
// A QFold<TResult,T> would be equivalent to a Foldable allowing to fold T to any TResult without mandating a common Val/Seq structure
template
<
class
TResult
,
typename
T
>
...
...
@@ -386,7 +386,7 @@ struct QBind<TSrcResult, Val<TDst>&&, IsReader<TSrcResult>> { static TSrcResult
Val
<
TSrcResult
>
srcVal
;
Val
<
TDst
>
dstVal
;
while
(
srcVal
=
srcSeq
.
_unsafeItem
(
0
))
{
// using item()'s Val<Seq<TSrcResult> would cause an infinite compiler loop to generate corresponding QBind<Val<Seq<Seq<...>>,_> functions
dstVal
=
dstSeq
.
_unsafeItem
();
srcSeq
=
srcVal
.
bind
(
dstVal
);
srcSeq
=
srcVal
.
bind
(
std
::
move
(
dstVal
)
)
;
}
/**/
dstSeq
.
out
();
...
...
tests/QBind/main.cpp
View file @
462cd303
...
...
@@ -305,11 +305,11 @@ int main()
QVector
<
QJsonReaderImpl
::
Error
>
jsonReaderErrors
;
QVector
<
JsonVisitorImpl
::
Error
>
jsonVisitorErrors
;
//
START {
//
json.seek(0); b.seek(0); b.buffer().clear();
//
jsonReaderErrors = QJsonReader(&json).bind(CborWriter(&b).value())->errors;
//
}
//
STOP("Json>Cbor",QString::fromUtf8(b.buffer().toHex()))
START
{
json
.
seek
(
0
);
b
.
seek
(
0
);
b
.
buffer
().
clear
();
jsonReaderErrors
=
QJsonReader
(
&
json
).
bind
(
CborWriter
(
&
b
).
value
())
->
errors
;
}
STOP
(
"Json>Cbor"
,
QString
::
fromUtf8
(
b
.
buffer
().
toHex
()))
START
{
json
.
seek
(
0
);
v
=
QJsonValue
();
jsonReaderErrors
=
QJsonReader
(
&
json
).
bind
(
v
)
->
errors
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment