Discussion:
[KPhotoAlbum] Tiny patch: Some missing includes
Henner Zeller
2014-11-29 07:18:47 UTC
Permalink
Hi,
While compiling kphotoalbum today (on wheezy), I had to add some includes -
functions used in ImagePreview.cpp and Dialog.cpp but whose headers were
missing.
Patch attached.

-h
Tobias Leupold
2014-11-29 11:23:38 UTC
Permalink
Hi :-)

I just had a look at it (not that I ever touched the respective code ...).
std::tuple is actually used in
AnnotationDialog::Dialog::selectionForMultiSelect, as well as std::tie. Both
seem to be part of the Boost package (at least here on current stable Gentoo).
std::tuple looks like a QPair counterpart (not sure about the std::tie thing,
as I'm not really a C++ guru ;-)

Why don't we use Qt here (instead of using "external" libraries)? I didn't see
some std::* stuff elsewhere, I'm just wondering if we could e. g. use

QPair<QStringList, QStringList>(itemsOnAllImages, itemsPartiallyOn);

instead of

std::make_tuple( itemsOnAllImages, itemsPartiallyOn );

of course with itemsOnAllImages and itemsPartiallyOn declared as QStringList
before and so on.

For the <algorithm.h> include: Where is this used? I didn't find it!

Cheers, Tobias
Post by Henner Zeller
Hi,
While compiling kphotoalbum today (on wheezy), I had to add some includes -
functions used in ImagePreview.cpp and Dialog.cpp but whose headers were
missing.
Patch attached.
-h
Henner Zeller
2014-11-30 01:46:02 UTC
Permalink
Post by Tobias Leupold
Hi :-)
I just had a look at it (not that I ever touched the respective code ...).
std::tuple is actually used in
AnnotationDialog::Dialog::selectionForMultiSelect, as well as std::tie. Both
seem to be part of the Boost package (at least here on current stable Gentoo).
std::tuple looks like a QPair counterpart (not sure about the std::tie thing,
as I'm not really a C++ guru ;-)
Why don't we use Qt here (instead of using "external" libraries)? I didn't see
some std::* stuff elsewhere, I'm just wondering if we could e. g. use
QPair<QStringList, QStringList>(itemsOnAllImages,
itemsPartiallyOn);
instead of
std::make_tuple( itemsOnAllImages, itemsPartiallyOn );
of course with itemsOnAllImages and itemsPartiallyOn declared as QStringList
before and so on.
For the <algorithm.h> include: Where is this used? I didn't find it!
<algorithm> is needed for std::all_of()
Post by Tobias Leupold
Cheers, Tobias
Post by Henner Zeller
Hi,
While compiling kphotoalbum today (on wheezy), I had to add some
includes -
Post by Henner Zeller
functions used in ImagePreview.cpp and Dialog.cpp but whose headers were
missing.
Patch attached.
-h
_______________________________________________
KPhotoAlbum mailing list
https://mail.kdab.com/mailman/listinfo/kphotoalbum
Tuomas Suutari
2014-12-08 22:22:09 UTC
Permalink
Hi,
Post by Tobias Leupold
I just had a look at it (not that I ever touched the respective code ...).
std::tuple is actually used in
AnnotationDialog::Dialog::selectionForMultiSelect, as well as std::tie. Both
seem to be part of the Boost package (at least here on current stable Gentoo).
std::tuple looks like a QPair counterpart (not sure about the std::tie thing,
as I'm not really a C++ guru ;-)
Actually std::tuple and std::tie are part of the C++11 standard, so if
you have new enough compiler, Boost isn't needed. (Though C++11
support may have to be activated with a compiler flag.)
Post by Tobias Leupold
Why don't we use Qt here (instead of using "external" libraries)? I didn't see
some std::* stuff elsewhere, I'm just wondering if we could e. g. use
QPair<QStringList, QStringList>(itemsOnAllImages, itemsPartiallyOn);
instead of
std::make_tuple( itemsOnAllImages, itemsPartiallyOn );
In this kind of stuff blame is good way to research why. (You may use
"git blame" on command line or web interface like [1].) By blaming the
file, I found out commit c786b3b [2], so the reason is "improved
readability and type safetity" as stated in the commit message.

[1] http://quickgit.kde.org/?p=kphotoalbum.git&a=blame&f=AnnotationDialog%2FDialog.cpp
[2] http://quickgit.kde.org/?p=kphotoalbum.git&a=commitdiff&h=c786b3b29828767586d1eb00909792d621b393d5
--
Tuomas
Henner Zeller
2014-12-08 23:34:28 UTC
Permalink
Post by Tobias Leupold
Hi,
Post by Tobias Leupold
I just had a look at it (not that I ever touched the respective code
...).
Post by Tobias Leupold
std::tuple is actually used in
AnnotationDialog::Dialog::selectionForMultiSelect, as well as std::tie.
Both
Post by Tobias Leupold
seem to be part of the Boost package (at least here on current stable
Gentoo).
Post by Tobias Leupold
std::tuple looks like a QPair counterpart (not sure about the std::tie
thing,
Post by Tobias Leupold
as I'm not really a C++ guru ;-)
Actually std::tuple and std::tie are part of the C++11 standard, so if
you have new enough compiler, Boost isn't needed. (Though C++11
support may have to be activated with a compiler flag.)
Still, the standard includes are needed - which was my original patch for.

(and yeah, I personally greatly prefer C++ standard stuff to annoying
Q-classes whenever possible.)
Post by Tobias Leupold
Post by Tobias Leupold
Why don't we use Qt here (instead of using "external" libraries)? I
didn't see
Post by Tobias Leupold
some std::* stuff elsewhere, I'm just wondering if we could e. g. use
QPair<QStringList, QStringList>(itemsOnAllImages,
itemsPartiallyOn);
Post by Tobias Leupold
instead of
std::make_tuple( itemsOnAllImages, itemsPartiallyOn );
In this kind of stuff blame is good way to research why. (You may use
"git blame" on command line or web interface like [1].) By blaming the
file, I found out commit c786b3b [2], so the reason is "improved
readability and type safetity" as stated in the commit message.
[1]
http://quickgit.kde.org/?p=kphotoalbum.git&a=blame&f=AnnotationDialog%2FDialog.cpp
[2]
http://quickgit.kde.org/?p=kphotoalbum.git&a=commitdiff&h=c786b3b29828767586d1eb00909792d621b393d5
--
Tuomas
_______________________________________________
KPhotoAlbum mailing list
https://mail.kdab.com/mailman/listinfo/kphotoalbum
Tuomas Suutari
2014-12-09 21:52:46 UTC
Permalink
Post by Henner Zeller
Post by Tuomas Suutari
Actually std::tuple and std::tie are part of the C++11 standard, so if
you have new enough compiler, Boost isn't needed. (Though C++11
support may have to be activated with a compiler flag.)
Still, the standard includes are needed - which was my original patch for.
(and yeah, I personally greatly prefer C++ standard stuff to annoying
Q-classes whenever possible.)
Ah, of course. Didn't read the patch since I was lazy and Gmail
doesn't show attached patches in browser.
Post by Henner Zeller
Ah, and Hi Tuomas :)
Hi! :-)
--
Tuomas
Tobias Leupold
2014-12-09 21:59:58 UTC
Permalink
Post by Tuomas Suutari
Actually std::tuple and std::tie are part of the C++11 standard, so if
you have new enough compiler, Boost isn't needed. (Though C++11
support may have to be activated with a compiler flag.)
Thanks for the clarification! Here on Gentoo, I could compile all this as-is,
so I think C++11 is enabled by default (or we just have a recent enough gcc).
If this is C++ itself, it's surely better to use it instead of Qt stuff.

Thanks for the hint with git blame. I'm still pretty new to all this ;-)
Continue reading on narkive:
Loading...