Wednesday, March 8, 2017

Digest for comp.lang.c++@googlegroups.com - 25 updates in 8 topics

Mike Copeland <mrc2323@cox.net>: Mar 08 02:10PM -0700

I have a fair amount of code to search for matches on constants and
assign "offset values" of the constants' position in an array. The code
is tedious and slow, and making changes to add new constants is
difficult.
In some other languages I've used there there's a way to assign an
"address value" that's coded in a table, so that a loop can be used to
scan for matches and assign a value to an associated variable whose
address is in the table. Something like:
 
{"NO.", &BNoffset, "BIB", &BNoffset, "PLACE", &OPoffset, etc. }
 
Is such a thing available in C++? If so, how is it coded and used?
TIA
 
// sample of current code:
int DPoffset, BNoffset, OPoffset, FNoffset;
[...]
DPoffset = BNoffset = OPoffset = FNoffset = -1;// defaults
[...]
string ws1; // data variable
size_t jj = tArray.size();
for(int kk = 0; kk < jj; kk++)
{
ws1 = tArray[kk];
if(ws1 == "NO.") BNoffset = kk;
if(ws1 == "BIB") BNoffset = kk;
if(ws1 == "PLACE") OPoffset = kk;
if(ws1 == "OPLACE") OPoffset = kk;
if(ws1 == "OVERALL_RANK") OPoffset = kk;
if(ws1 == "TEAMPLACE") OPoffset = kk;
if(ws1 == "FIRST NAME") FNoffset = kk;
[etc.]
}
 
 
 
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 08 10:33PM +0100

On 08-Mar-17 10:10 PM, Mike Copeland wrote:
> if(ws1 == "FIRST NAME") FNoffset = kk;
> [etc.]
> }
 
It seems that for BNoffset you want it to get the index of the last
occurrence of "NO." or "BIB" in the array.
 
Is this correct, and if so, what do you use that for?
 
 
Cheers!,
 
- Alf
woodbrian77@gmail.com: Mar 08 10:40AM -0800

Shalom
 
I was thinking about adding serialization support for plf::stack
to my on line code generator. But in looking into the interface
for this container: http://plflib.org/stack.htm
 
and std::stack: http://www.cplusplus.com/reference/stack/stack/
 
it seems that neither of them permit the telepathic kinesis needed
for serialization. As a morally straight boy scout, I'd like to
be prepared for the case where someone wants to marshal a stack
between programs.
 
I didn't check, but possibly the same problem exists for std::queue.
Any thoughts on how to approach this? Thanks in advance.
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 08 09:53PM +0100


> and std::stack: http://www.cplusplus.com/reference/stack/stack/
 
> it seems that neither of them permit the telepathic kinesis needed
> for serialization.
 
You can serialize a `std::stack` by accessing the protected container
member.
 
One way to access it is by using a member data pointer.
 
#include <iostream>
#include <stack>
 
template< class Item, class Container >
auto container_of( std::stack<Item, Container> const& st )
-> Container const&
{
struct Access: std::stack<Item, Container>
{
using std::stack<Item, Container>::c;
};
 
return st.*&Access::c;
}
 
auto main()
-> int
{
std::stack<int> st;
for( const int v : { 3, 1, 4, 1, 5, 9 } ) { st.push( v ); }
 
for( int const v : container_of( st ) )
{
std::cout << v << "\n";
}
}
 
> be prepared for the case where someone wants to marshal a stack
> between programs.
 
> I didn't check, but possibly the same problem exists for std::queue.
 
Same solution.
 
 
Cheers & hth.,
 
- Alf
woodbrian77@gmail.com: Mar 07 05:03PM -0800

Shalom
 
I've added serialization support for Matthew Bentley's
colony container -- http://plflib.org --
to the C++ Middleware Writer. I also added some code that
tests this support to the example directory of my Github repo -- https://github.com/Ebenezer-group/onwards .
 
Probably the C++ Middleware Writer is one of the only
serialization options that supports colonies. "We few,
we happy few ..."
 
Thanks to Jon Kalb for his CppChat show where he talked
to Matthew about this container --
http://www.slashslash.info/cppchat/
https://www.youtube.com/watch?v=SFAJ238rBNw
 
. One of the things Matthew and Jon talked about was what
was said about this container at the recent C++ standards
meeting in Hawaii. Matthew said the committee had some positive
things to say about adding the container to the standard and Jon
suggested "condominium" as a possible alternative name. I'm
fine with the name as it is.
 
 
Brian
Ebenezer Enterprises -- "You are the light of the world. A city
on a hill cannot be hidden." Matthew 5:14
 
http://webEbenezer.net
red floyd <dont.bother@its.invalid>: Mar 08 10:08AM -0800

On 3/7/2017 5:03 PM, woodbrian77@gmail.com wrote:
[redacted]
 
Please don't spam your product here.
 
[hey, if you can complain about language, I can
complain about spam]
woodbrian77@gmail.com: Mar 08 12:10PM -0800

On Wednesday, March 8, 2017 at 12:08:23 PM UTC-6, red floyd wrote:
 
> Please don't spam your product here.
 
"A fool with a plan can outsmart a genius with no plan."
T. Boone Pickens
 
Some of Boost is genius without a plan. I guess that
still surprises some people here. Maybe it would help
to think of my software as an alternative to the
serialization library in Boost, but that isn't itself
in Boost. Originally, I believe, Matthew Bentley was
going to try to have his colony container added to Boost.
But that's not really a necessary step, and it looks like
colony will pass-over Boost on it's way to the standard.
I'm thinking some of Boost is cool and all for years,
but have known that formal inclusion in Boost wasn't a
necessary step for me either. :) Might as well get used
to on line code generation. I've been saying these things
for ye
 
 
Brian
Ebenezer Enterprises - Honoring G-d through excellence.
http://webEbenezer.net
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 08 08:12PM

> necessary step for me either. :) Might as well get used
> to on line code generation. I've been saying these things
> for ye
 
Fuck off you mentalist.
 
/Flibble
woodbrian77@gmail.com: Mar 08 12:14PM -0800

> necessary step for me either. :) Might as well get used
> to on line code generation. I've been saying these things
> for ye

for years.
 
 
 
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 08 09:42PM +0100

> T. Boone Pickens
 
> Some of Boost is genius without a plan. I guess that
> still surprises some people here.
 
Good quote and I agree with you there.
 
 
> to think of my software as an alternative to the
> serialization library in Boost, but that isn't itself
> in Boost.
 
To announce your library properly you can
 
* announce it.
 
In earlier times you could just put it in the montly posted C++ library
listed, but that stuff seems to be gone.
 
 
[snip]
 
Cheers!,
 
-Alf
woodbrian77@gmail.com: Mar 07 05:45PM -0800

On Tuesday, March 7, 2017 at 4:47:58 PM UTC-6, Richard wrote:
 
Please don't swear here.
 
 
Brian
Ebenezer Enterprises - Enjoy programming again.
http://webEbenezer.net
red floyd <no.spam@its.invalid>: Mar 07 06:57PM -0800

> On Tuesday, March 7, 2017 at 4:47:58 PM UTC-6, Richard wrote:
 
> Please don't swear here.
 
Fuck off.
Ian Collins <ian-news@hotmail.com>: Mar 08 05:11PM +1300

On 03/ 8/17 03:57 PM, red floyd wrote:
 
>> Please don't swear here.
 
> Fuck off.
 
What he said.
 
--
Ian
woodbrian77@gmail.com: Mar 07 08:41PM -0800

On Tuesday, March 7, 2017 at 8:57:20 PM UTC-6, red floyd wrote:
 
Sorry, but it looks like I'm going to be here for a while ...
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
Moai <penultimategrill@gmail.com>: Mar 08 02:00AM -0500

On 2017-03-07 13:57, Richard wrote:
> I never recommended it for BSD. I recommended it for Linux or MacOS.
 
> Seriously.
 
> Try reading before posting.
Please don't move the goalposts, ください。
red floyd <dont.bother@its.invalid>: Mar 08 10:06AM -0800

> On Tuesday, March 7, 2017 at 8:57:20 PM UTC-6, red floyd wrote:
 
> Sorry, but it looks like I'm going to be here for a while ...
 
Do you do anything here other than spam your fucking program
and bitch about other people's language?
 
Oh, and the fuck off was just about your complaining.
legalize+jeeves@mail.xmission.com (Richard): Mar 08 06:55PM

[Please do not mail me a copy of your followup]
 
penultimategrill@gmail.com spake the secret code
 
>> Seriously.
 
>> Try reading before posting.
>Please don't move the goalposts.
 
Non sequitur. Here is an excerpt from my original recommendation:
 
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Mar 08 07:15PM

On Wed, 8 Mar 2017 10:06:41 -0800
 
> Do you do anything here other than spam your fucking program
> and bitch about other people's language?
 
> Oh, and the fuck off was just about your complaining.
 
Well, he still owes me an apology from last week.
 
Apart from that he is a significant weirdo. This post still remains my
most favorite of all for demonstrating his bizarre self-estimation:
http://comp.lang.cpp.narkive.com/q0Yuq9Cf/comments-on-interview-of-scott-meyers
 
If anyone wondered whether he is to be taken seriously, that should
answer it.
Daniel <danielaparker@gmail.com>: Mar 07 08:59PM -0800

On Tuesday, March 7, 2017 at 3:33:50 PM UTC-5, Mr Flibble wrote:
> evidence do you have for this transition? The truth is the entire
> genealogy is suspect. The Bibles (OT and NT) that are supposedly divine
> are demonstrably erroneous.
 
You have to keep in mind what the authors of Luke and Matthew were trying to
do. It had been prophesied that the Jewish Messiah would be a descendant of
David, they therefore felt it was necessary to imagine that lineage for
Jesus. Since they did so independently, they came up with different names.
 
That doesn't tell you anything about whether Jesus was an actual historical
figure, though.
 
Daniel
leigh.v.johnston@googlemail.com: Mar 08 12:23AM -0800

Bullshit.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 08 05:00AM -0800

On Tuesday, March 7, 2017 at 4:41:22 PM UTC-5, Chris M. Thomasson wrote:
> Hey Rick, I am wondering if you can compile and run this:
> http://pastebin.com/raw/hXQfrCSN
 
What is it?
 
Thank you,
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 08 05:18AM -0800

Knowledge of Jesus Christ doesn't come from the flesh. You won't be
able to reason your way into His Kingdom because it's not a flesh-
based thing. God is spirit, and those who come to Him will do so
from a different source than flesh-based reasoning. It's why the
gateway is through an inner drive/desire to seek the truth. It's not
even something we can find on our own (because it's spirit, and we do
not possess faculties to discern spiritual things). God has to reach
into our core and make changes to our inner being so that we are then
enabled to discern spiritual things. Only when that happens can a
person come to faith, and only then are they able to see His Kingdom,
place significance and priority on His Kingdom ahead of the things in
this world, and so on.
 
If you want to come to Jesus Christ, you have to set your sights on
the truth. You may not even know what you'll find, what it will be
like, how you will feel when you get there, etc. That's expected.
It is the truth-pursuit that God is seeking in each of us, and for
all of those who seek the truth with full-on vehemence, to those He
opens up our ability to receive it, and be saved.
 
http://biblehub.com/kjv/john/6-44.htm
44 No man can come to me, except the Father which hath sent me
draw him: and I will raise him up at the last day.
 
http://biblehub.com/kjv/john/6-63.htm
63 It is the spirit that quickeneth; the flesh profiteth nothing:
the words that I speak unto you, they are spirit, and they are
life.
 
http://biblehub.com/kjv/john/3.htm
5 Jesus answered, Verily, verily, I say unto thee, Except a man be
born of water and of the Spirit, he cannot enter into the kingdom
of God.
6 That which is born of the flesh is flesh; and that which is born
of the Spirit is spirit.
 
You must be born again, and that's not something you can reason your
way into as by the flesh. Only when God makes that change within you
can you then see it. And all you have to do is seek the truth.
 
Some things to consider:
 
(1) Do you have sin? (Ever told a lie, stolen something, used
God's name as a cuss word, lusted after someone who was not
your spouse)
(2) When a person goes before a righteous judge, will the good
deeds of that person in their life outweigh their crime, such
as they won't be convicted of the murder because they've been
a good citizen, helping people, being kind, loving, generous?
(3) God is truth, and His court is perfect. When we stand before
Him, can we expect Him to honor the Laws of His Kingdom? Or
will He be as a corrupt judge taking bribes to allow the
guilty to pass through into His Holy Righteous Kingdom?
(4) We are taught in scripture (Romans 3:23, Romans 6:23) that
all have sinned and fall short of the glory of God. We are
taught that "the wages of sin is death," meaning when you sin
you receive your wages for that activity: death, and the
death the Bible speaks of is not our physical death, but it
is the death of our soul in Hell forever, because all people
will die physically in their body, but that is just a door to
what comes after, it is not the end.
(5) Because of sin there was no way out for mankind. We were lost
forever. But God was not prepared to lose all of us, because
even here in this wretched hate-filled warring fallen world,
there are some people who will seek the truth, and do desire
love and compassion, who do want to help people without trying
to take advantage of them. So God sent His Son to make a way
out, a way out of now way because we could not save ourselves.
(6) If you are a sinner, then you need a savior. For this cause
Jesus entered the world ... to bring the lost into salvation,
to bring the guilty into a right standing with God. But, He
will only do this for those who seek the truth, and desire
from their inner core to be a part of that Kingdom, knowing
that their sin is wretched and filthy and evil and harmful,
and only for those desiring to then also cease their sin, and
follow after Him in this world in pursuit of truth, love, and
all manner of right and uplifting/helping things.
(7) We can do none of this on our own. We can only head in that
direction. God then reaches in and does the rest for us,
which is what makes the transformation possible. I, Rick,
cannot save myself. I can't make myself desire to be holy
and then do it. Only Christ living in me makes it possible,
because all Rick's flesh wants to do is pursue its lusts.
 
(8) It takes the spirit to overcome the flesh, and that is what
Jesus brings to us when He takes our sin away. We are born
again spiritually, which augments our existence so we are
then both flesh and spirit. But as we press in and pursue
the spirit with effort and discipline, we are able to in all
ways overcome the flesh and its lusts, its draws and pulls
on us in this world.
 
Jesus brings life to the lifeless. Hope to the hopeless. He makes
all things new, and sets our course once again on eternity, rather
than on the shiny trinkets of this dying world.
 
Thank you,
Rick C. Hodgin
Christiano <christiano@engineer.com>: Mar 08 10:13AM -0300

On 03/06/2017 06:05 PM, Christiano wrote:
> "A stream that is bad() is also fail()"
 
> This statement seems to work in the vast majority of cases, but it can't
> be postulated as a general rule.
 
I need to correct myself here.
It CAN be postulated as a general rule because ISO/IEC 14882:2011(E)
27.5.5.4.9 says:
 
bool fail() const;
Returns: true if failbit or badbit is set in rdstate(). [303]
 
where [303] is: Checking badbit also for fail() is historical practice.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 08 05:01AM -0800

On Tuesday, March 7, 2017 at 4:41:22 PM UTC-5, Chris M. Thomasson wrote:
> Hey Rick, I am wondering if you can compile and run this:
> http://pastebin.com/raw/hXQfrCSN
 
What is it?
 
Thank you,
Rick C. Hodgin
kushal bhattacharya <bhattacharya.kushal4@gmail.com>: Mar 08 02:25AM -0800

thing is i have to spawn some threads manually first which will sit idle in a different context and then in some callback other threads are created there and when value is updated on that thread it delegates work to those idle threads .How do i do that in c++
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: