- Still no inheritiance for enums? - 5 Updates
- lock-free single-producer/multi-consumer unbounded queue... - 1 Update
- Fwiw, a thread-safe c++ deque example... - 1 Update
- What is Christian evangelism all about? - 2 Updates
- The Lord calls out to you for repentance, salvation - 13 Updates
- C++ class that may or may not own resource for convienence - 1 Update
- C++ class that may or may not own resource for convienence - 1 Update
- ,, - 1 Update
Christopher Pisz <christopherpisz@gmail.com>: Mar 21 08:53AM -0700 On Monday, March 20, 2017 at 8:20:56 PM UTC-5, Chris Vine wrote: > > via crappy Google Groups? I see it when I hit reply. The thought of > > the incoming spam is scarey. > Yes I do. But the google mail spam filters are pretty good. Crap. I see no option for changing that or disabling it for the first post. Only for subsequent replies. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 09:14AM -0700 On Monday, March 20, 2017 at 7:59:19 PM UTC-4, Alf P. Steinbach wrote: > For example, if enums could be used interchangably then you would have > that enum{a, b, c} IS-A enum{a, b, c, d, e}, because any value of the > former is a valid value of the latter. I disagree. In the construction of the class, which is derived from a parent class at compile-time, it should augment the definition of the input (the parent class, coupled with any other classes), such that the final result in the child class which references the other class(es), has a combined form which is accessible against that object as the cumulative type. However, when referencing the same type through one of the other objects, only those members which were visible to them at compile-time should be referenced. I think this is a failing in C++. > -- an Integer always converts to an exactly corresponding Rational > and in that sense Integer IS-A Rational, but it's not the case that > every Rational IS-A Integer. From the point of view of each thing, they should be wholly reconcilable, easily understood, and processed properly. > I believe this was first discussed by M.I.T. professor Barbara Liskov, > in the same work where she formulated her famous substitution principle. > It should not be difficult to see why the two things relate. ;-) That's an incorrect application in this case. C++ has it wrong, and the OP above has it right. > > Is the way to do this still to use static const values instead? > I'm not aware of any good solution, sorry. > The programming languages that I'm familiar with do not support notion. That's not to say that your request doesn't make perfect sense, Christopher Pisz ... because it does. Base::Color would be a type with three members. Derived::Color would be another type with four members. It is perfectly clear in code, in meaning, in syntax (were it to be applied that way, though I could see the need to augment the other classes for inheritance with "enum Color {..., Yellow}" to indicate you're adding to the prior thing). Thank you, Rick C. Hodgin |
"Tristan B. Kildaire" <deavmi@disroot.org>: Mar 21 06:47PM +0200 On 2017/03/21 6:14 PM, Rick C. Hodgin wrote: > indicate you're adding to the prior thing). > Thank you, > Rick C. Hodgin Is enums and inheritance a useful feature? Could you explain how? |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 10:02AM -0700 On Tuesday, March 21, 2017 at 12:47:10 PM UTC-4, Tristan B. Kildaire wrote: > Is enums and inheritance a useful feature? Could you explain how? The OP gave one. And the usefulness is obvious: Base classes are a particular generalized type. Inherited classes are a more specialized form of that general type. It would be natural to be able to extend enums to include additional information that the base class knows nothing about in the more specialized form. Thank you, Rick C. Hodgin |
Christopher Pisz <christopherpisz@gmail.com>: Mar 21 01:11PM -0700 On Monday, March 20, 2017 at 3:13:21 PM UTC-5, Christopher Pisz wrote: > where we want derived to have Colors: RED, BLUE, GREEN, and YELLOW > Is the way to do this still to use static const values instead? I talked to a friend of mine during lunch, whom happens to be a .NET developer. He claims that any time he sees an enum that it raises a red flag for him. He'd rather create class for each state. If we use an example where we make a class Socket with enum {CONNECTED, DISCONNNECTED} and then derive a class MySpecificClientSocket that wants to add a state LOGGED_IN and perhaps other derived classes that have yet more states that are only used in their specific use. He'd create a MySpecificSocketConnected, MySpecificSocketDisconnected, MySpecificSocketLoggedIn, classes that implement the specific functionality that is permitted in their states. That would make for a lot of classes! I guess that comes from a DDD mindset. Thoughts on that? |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 21 08:58PM +0100 When you have a producer-consumer-relation, the time to enqueue and to dequeue an item is very short in relation to prepare and process that item. So the likehood of a collision when accessing a queue locked by a traditional mutex/condvar-duo is extremely low. So expecially for producer-consumer-relationships, lockfree processing provides almost no benefit over traditional locking. -- http://facebook.com/bonita.montero/ |
"Chris M. Thomasson" <invalid@invalid.invalid>: Mar 21 12:32PM -0700 On 3/20/2017 10:15 PM, Alf P. Steinbach wrote: > The `=` here gives you an assignment, not a reference re-seating (i.e., > it this throws then the out param does not reference the front of the > queue – it is instead unchanged, if that assignment guarantees that). Yikes! My C++ is rusty. Your are correct and I am wrong about the reference. Also, pop_front does not seem to throw even if the side is zero, according to: http://en.cppreference.com/w/cpp/container/deque/pop_front However, it does seem to fire off an assert saying that the deque was empty, perhaps because NDEBUG was not defined. It messes things up if one executes pop_front on an empty deque. Undefined Behavior Indeed! > Since `m_queue.front()` produces a regular reference, the `=` here > denotes a regular copy assignment, not a move assignment. Ditto. > guarantee, which Dave Abrahams called "the strong exception guarantee", > then all that happens if that assignment fails is that the assignment > fails, and execution of pop() is terminated via the exception. [...] > { > out = m_queue.front(); // Copy, possible exception. > } Nice! Thank you for that. Did not know about it until now. Love to learn new things Alf. :^) > but > Dequeued_<T> const item{ q }; // Good enough, IMHO. :) > I did not optimize that for noexcept, but it's not difficult to add. I like your code. First of all it helps me learn about some of the new C++ modern constructs. My C++ code seems a bit dated, except for using the new fancy threading constructs, I have not even used the auto keyword yet in my code! ;^ My exception handling in C++ can be vastly improved. The fact is, that you, and others have helped me in this thread. Reading your code using all the new C++ stuff rather heavily, is okay with me! Thank you: Alf P. Steinbach |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 11:21AM -0700 It's about one thing: Forgiveness of sin from Jesus Christ, which leads to: (a) Salvation of your eternal soul, (b) A change of your life here on Earth, (c) Being given the strength to say no to sin, and yes to God, (d) ----- Jesus makes you a new creation. It's not about church, it's not about being a better person. It's about Him giving you NEW LIFE, giving you THE SPIRIT, which is ETERNAL LIFE. http://biblehub.com/kjv/john/3.htm 3 Jesus answered and said unto him, Verily, verily, I say unto thee, Except a man be born again, he cannot see the kingdom of God. 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. It is a literal new birth, a second birth ... the first was our flesh, the second is the spirit. And from that point forward, we are alive eternally, will never die even though we shed our bodies in this world, yet will we enter into Heaven alive. It is God's free gift of eternal life to all who will receive it. It is God's full pardon of sin, forgiveness of all wrongdoing, and a second chance at being the creation He intended each of us to be before sin entered in and wrecked everything. It is God fulfilling His own perfect Law, but in a way which makes it possible for us (the guilty) to go free, while He Himself pays the price of our iniquity in our place. There is no greater gift imaginable ... for this is ETERNAL life. Thank you, Rick C. Hodgin |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 11:26AM -0700 On Tuesday, March 21, 2017 at 2:21:59 PM UTC-4, Rick C. Hodgin wrote: > (b) A change of your life here on Earth, > (c) Being given the strength to say no to sin, and yes to God, > (d) For item d: (d) ... your life changed and lived for Him You fill in your own blank on how that affects your life, based on the extent to which you pursue Him, the gifts He's able to give you (because you reach the proper levels of maturity in Christ, and as a Christian operating in this world). He has abundance to give ... beyond our ability to receive. But as a good Father, He won't put too much upon His son (you and me), not until such time as we've gone through proper training, gained the proper levels of experience, have been through boot camp, officer training, etc., only then will we reach the new levels. For those who seek with diligence and discipline and study, that may come quickly. For others, it may never come. It doesn't change our salvation, but it does change our blessings, both here in this world, and in the age to come. > it possible for us (the guilty) to go free, while He Himself pays > the price of our iniquity in our place. > There is no greater gift imaginable ... for this is ETERNAL life. Jesus calls you to greatness. Seek Him with urgency. Thank you, Rick C. Hodgin |
Daniel <danielaparker@gmail.com>: Mar 21 05:44AM -0700 On Tuesday, March 21, 2017 at 6:41:29 AM UTC-4, Rick C. Hodgin wrote: > Such as ... ? 1 Judge not, that ye be not judged. 2 For with what judgment ye judge, ye shall be judged: and with what measure ye mete, it shall be measured to you again. 3 And why beholdest thou the mote that is in thy brother's eye, but considerest not the beam that is in thine own eye? |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 06:03AM -0700 On Tuesday, March 21, 2017 at 8:44:34 AM UTC-4, Daniel wrote: > On Tuesday, March 21, 2017 at 6:41:29 AM UTC-4, Rick C. Hodgin wrote: > > Such as ... ? > 1 Judge not, that ye be not judged. 2 For with what judgment ye judge, ye shall be judged: and with what measure ye mete, it shall be measured to you again. 3 And why beholdest thou the mote that is in thy brother's eye, but considerest not the beam that is in thine own eye? It is a common conclusion for people to reach that Christians are judging others when they teach about those things Jesus taught us. But there is more to it than that. For example, have you ever read the whole of that sermon? http://biblehub.com/kjv/matthew/5.htm http://biblehub.com/kjv/matthew/6.htm http://biblehub.com/kjv/matthew/7.htm Jesus is guiding people toward the things they should do. But even that is not the end of His speaking on the matter. He later gives His disciples a commandment wherein He instructs them to go forth and teach all people world-wide about Him, about sin, about the free gift of salvation offered by God to all. The commandment given to the people to go forth and teach them to obey all things God has commanded: http://biblehub.com/kjv/matthew/28.htm 18 And Jesus came and spake unto them, saying, All power is given unto me in heaven and in earth. 19 Go ye therefore, and teach all nations, baptizing them in the name of the Father, and of the Son, and of the Holy Ghost: 20 Teaching them to observe all things whatsoever I have commanded you: and, lo, I am with you alway, even unto the end of the world. Amen. And Jesus gave us a new literal commandment: http://biblehub.com/kjv/john/13-34.htm 34 A new commandment I give unto you, That ye love one another; as I have loved you, that ye also love one another. Such a love does not allow the people (non-believers) around us (Christians) to go forth in their life untaught. We lead by the example of our life (in how we live our lives), but we also teach with our mouths those things God would have us do. As with Jesus, we do not want anyone to perish. But people in and of themselves will not seek out knowledge of God because of our sin nature. We will run away from that knowledge, which is why the knowledge must be brought to them. It's actually a prayer that we are to pray oft, in that Jesus said: http://biblehub.com/kjv/luke/10-2.htm 2 Therefore said he unto them, The harvest truly is great, but the labourers are few: pray ye therefore the Lord of the harvest, that he would send forth labourers into his harvest. We (people) are the harvest. The laborers are Christians who then go out into the harvest fields (the peoples of the world) and teach them the truth about God, so that those who have an ear to hear will hear that truth, be converted, and be saved. We are sowing seeds of the message of truth to all people, so that those who have an ear to hear His message will hear and be saved. It is literally for that group of people who will be saved that we labor. It is not for those who will not be saved, for they are already self-condemned (http://biblehub.com/kjv/john/3-18.htm). ----- The things I teach in this group and others relate to those things the Lord has given us, and those things He has warned us HE WILL JUDGE. His Judgment will come with finality, after a life lived in rebellion against His many attempts to reach out and save a soul. Only then, after that witness has been demonstrated sufficiently will the person then be cast into Hell, and it will be by their own conscious choice to run away from God, away from truth, away from the free offer of salvation through Jesus Christ following what He did on the cross. ----- Bottom line: I have no judgment to lay down upon anyone, and I do not judge anyone. I hold all people's actions and works under scrutiny against scripture, and that includes my own, and I am able to conclude an assessment of where people are (and where I am) relative to what scripture teaches. That is our responsibility as Christians, so we know how to walk in this world. God gave us this as a right and proper course as we are called to rightly divide the word of truth (biblehub.com/kjv/2_timothy/2-15.htm), which is an ongoing, in all cases, at all times, without vacation, teaching ministry. We are His servants here, but we are also His ambassadors. When we go out, we are going forth as Citizens of His Kingdom, and not merely as inhabitors of the Earth. We are here to do His will, and not the will of this world. And the things we teach are of His Kingdom, which He is offering to all people today, so that those who have an ear to hear can hear His message, come out from the deception of the world, and be saved. Thank you, Rick C. Hodgin |
Daniel <danielaparker@gmail.com>: Mar 21 06:46AM -0700 On Tuesday, March 21, 2017 at 9:03:45 AM UTC-4, Rick C. Hodgin wrote: > teach You're not teaching, you're blathering :-) And annoying. I need to figure out how to use that kill file and kill sub thread thing. Daniel |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 06:55AM -0700 On Tuesday, March 21, 2017 at 9:46:21 AM UTC-4, Daniel wrote: > > teach > You're not teaching, you're blathering :-) And annoying. I need to > figure out how to use that kill file and kill sub thread thing. Mr. Miyagi once said: "There is no such thing as bad student. Only bad teacher. Teacher say. Student do." But ... I have to disagree with his conclusion. There while there are definitely bad teachers, there are also bad students, and both of them exist directly as the result of original sin, our sin nature, and our ability to know both good and evil, and our inability to know the spiritual difference between the two. Daniel ... if you think I'm a bad teacher, then I would ask you this: If God and Jesus were true, and there really was sin, and there really was eternal judgment for sin, and that place of confinement for the eternal judgment for sin really was Hellfire ... would you want to know in advance? Would you want to know the truth? Only you can answer that question for you. But if your answer is "yes," then don't rely upon my failings to be the reason why you then don't press in and pursue the matter. Seek out the true and real information for yourself. The answers are there before you, and God WILL open up your understanding to receive it ... if you will come to Him wanting to know the truth (even if you don't yet know what that truth is). Do not let anyone stand in the way of you coming to the true and right knowledge of a thing. Not me. Not your family. Not your spouse. Not your kids. Not anyone. You owe it to yourself and everyone in your life to discover the truth, and to be able to know for yourself with unreserved assuredness ... so that you can then be walking in this world as you should, teaching others as you should, and not be being deceived by other inputs and sources such that you are misguided, and are then also misguiding others. You are a most valuable creation, Daniel. It's why Jesus did for you what He did at the cross. But it's still up to you to receive it. And the only way to receive it is to know that it is real. And the only way to know if it is real is to taste and see for yourself, to seek out for yourself, to see if Rick is crazy, or if Rick is a right servant of God doing his best to reach others. Seek the truth, Daniel. It will literally make you free. Thank you, Rick C. Hodgin |
"Tristan B. Kildaire" <deavmi@disroot.org>: Mar 21 04:34PM +0200 On 2017/03/21 3:55 PM, Rick C. Hodgin wrote: > Seek the truth, Daniel. It will literally make you free. > Thank you, > Rick C. Hodgin C++ needs salvation. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 07:42AM -0700 On Tuesday, March 21, 2017 at 10:34:28 AM UTC-4, Tristan B. Kildaire wrote: > C++ needs salvation. I'm working on that too: CAlive -- It's C extended to include the basic class, and with some new features of my own added in: To all: Please consider joining the Google Group, and participating in the project. It is an offering of the best we possess as the unique and special people we are ... but with a twist: Instead of just giving our talents to other people, we explicitly give them back to God (from whom they came), and to other people. In doing this, we honor Him with the fruits of those things He first gave us. If you are able to code at the levels necessary to write a compiler, and have a desire within you to give back to God, then please consider coming to the project and helping out. Your contribution would make a difference. CAlive and the RDC (Rapid Development Compiler) framework, a generic framework which allows compilers to be written within, allowing rapid creation of new compilers for other languages, and all with the features and support of the base framework. Kind of like a GCC, but one where we honor God explicitly with our offering: https://groups.google.com/forum/#!forum/caliveprogramminglanguage https://groups.google.com/forum/#!forum/rapid_development_compiler Thank you, Rick C. Hodgin |
"Tristan B. Kildaire" <deavmi@disroot.org>: Mar 21 04:48PM +0200 On 2017/03/21 4:42 PM, Rick C. Hodgin wrote: > https://groups.google.com/forum/#!forum/rapid_development_compiler > Thank you, > Rick C. Hodgin I'm so confused. Does Pope Francis maintain his own popecc? |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 08:08AM -0700 On Tuesday, March 21, 2017 at 10:48:26 AM UTC-4, Tristan B. Kildaire wrote: > > https://groups.google.com/forum/#!forum/caliveprogramminglanguage > > https://groups.google.com/forum/#!forum/rapid_development_compiler > I'm so confused. Does Pope Francis maintain his own popecc? I don't know. I have any affiliation with the Pope. As a Christian, I desire to offer up the fruits of the skills and talents God first gave me back to Him in an honoring and pleasing way. I looked into supporting GNU and Linux before I began on this project. I found Richard Stallman believes in very anti-Christian things (such as pedophilia, necrophilia). And Linus Torvalds is exceedingly vulgar and rude. I realized I did not want to contribute to entities led by such men. So, I created my own Christ-seeking entity called Liberty Software Foundation. It was to be like Free Software Foundation, but it was to be for Christ. I began on July 12, 2012, and have continued since on my first project, which was a follow-on replacement for Visual FoxPro. http://www.visual-freepro.org/wiki/index.php/Main_Page Due to the Christian nature of the project, I could never get people to help me until 2015. And when I did get someone to help me, it was for about three months. I've learned people do not want to give their talents back to God. They want to run away from God toward the things of this world. It makes it a very lonely journey thus far. But, I know the value of serving Him with the fullness of my life ... so I press on unabated. There are many aspects of the project I'm involved on. Software development is only one part. I desire to build an entire hardware and software stack devoted to an offering devoted to God. It is a way we can create an entire machine, including all aspects of the manufacturing, which tie back to using our talents not for money, not for corporate gains, not to take advantage of people by selling them something that costs us $200 to make for $2000 because the market will bear such a cost, but rather to be fair, and equitable, and to make people's lives better. To give them tools they can fix and repair themselves with minimal cost and time, rather than the current practice of producing throw-away devices. I have a phone right now with a bad power switch. I've been told by the phone people it can't be repaired by their services, and that I need to throw it away and buy another one. I never want to do that to people. I want to give them solutions in all areas of their life which empower them to be more, do more, learn more, move further, reach out with their personal unique and special expression of self, but to guide them toward doing so in a manner which acknowledges God as their creator. It's a mission toward those things those who enter into eternity will do for all eternity, being as they will be in His presence without end. But it is our offering, by choice, by conscious choice, here upon this Earth ... an honor of Him in our lives, for all He's done for us, not just in our lives and abilities and talents and opportunities, but even more so for what He did for us at the cross, making it possible for us to then be with Him forever. For His great gift ... it's the least we can do to return our lives to Him here on this Earth, explicitly acknowledging Him with the full and rich goodness of all of our talents and abilities, coming together as this community of believers, to give to Him and the world an offering of those things He first gave us, lifted up to Him so that we are in all ways honoring Him. It is our greatest Earthly gift ... to do all for Him, as we go through our lives doing all the things we do as the unique and special people we all are. He has unique and diverse plans for us here upon the Earth. We need not lose any degree of individuality in acknowledging Him in His right- ful place as our Lord and Savior. He wants us to be programmers, and bricklayers, and cooks, and teachers, and CEOs and everything else ... but He wants us to do it for Him, to help His people, to guide His people to His Son, to lead in our lives by example, also teaching with our words. He wants us to hold Him in the place to which He deserves us to hold Him. He is God Almighty ... and we should acknowledge Him as such as we then go forth doing the things we'll do. Thank you, Rick C. Hodgin |
"Tristan B. Kildaire" <deavmi@disroot.org>: Mar 21 06:47PM +0200 On 2017/03/21 5:08 PM, Rick C. Hodgin wrote: > we then go forth doing the things we'll do. > Thank you, > Rick C. Hodgin I can agree with you that Richard Stallman is fucked in the head. |
"Tristan B. Kildaire" <deavmi@disroot.org>: Mar 21 06:49PM +0200 On 2017/03/21 5:08 PM, Rick C. Hodgin wrote: > we then go forth doing the things we'll do. > Thank you, > Rick C. Hodgin TL;DR. But I agree with a lot of what you said. RMS is fucked up and Torvalds is rude. I wish well to your foundation and its projects. Maybe oneday I will step by. I am a Roman Catholic. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 10:05AM -0700 On Tuesday, March 21, 2017 at 12:49:41 PM UTC-4, Tristan B. Kildaire wrote: > ...I am a Roman Catholic. Perhaps you are a Roman Catholic, but you bear much evidence that you do not know Jesus Christ as Lord and Savior. If that fact matters to you ... you must do your due diligence to pursue Jesus Christ, lest you be cast into Hell with the rest of the non- believers: http://biblehub.com/kjv/matthew/7.htm 21 Not every one that saith unto me, Lord, Lord, shall enter into the kingdom of heaven; but he that doeth the will of my Father which is in heaven. 22 Many will say to me in that day, Lord, Lord, have we not prophesied in thy name? and in thy name have cast out devils? and in thy name done many wonderful works? 23 And then will I profess unto them, I never knew you: depart from me, ye that work iniquity. Thank you, Rick C. Hodgin |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 21 06:24PM +0100 Am 11.03.2017 um 14:32 schrieb Rick C. Hodgin: > The message is simple: He wants to forgive your sin and give > you eternal life in the paradise of God. > ... I'm sure there are newsgroups which appropriate for such postings. But here you are wrong. -- http://facebook.com/bonita.montero/ |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 21 10:35AM -0700 On Tuesday, March 21, 2017 at 1:25:06 PM UTC-4, Bonita Montero wrote: > > ... > I'm sure there are newsgroups which appropriate for such postings. > But here you are wrong. The Lord came to save everybody who will be saved, Bonita. Even the people who won't go to those "appropriate" newsgroups because they contain messages about "religious stuff." It's the very reason we are commanded to go forth and teach all people worldwide, to teach even those people in the "inappropriate" places where sinners hang out, even to the "inappropriate newsgroups" where other subjects are discussed. FWIW, I only go to the places where I have personal interest. I have no interest in those "appropriate" newsgroups because they often talk about religion. Christianity is not religion, it's a close, personal relationship with Jesus Christ. We come to Him asking for forgiveness, and in so doing are saved. We are then alive spiritually, able to walk with Him throughout the rest of our days. It's not religion, it's a literal transformation. This change is available to all people ... even the people in these types of technical forums. It's why I teach the same here (because others are not doing it). The message goes out to everyone, Bonita, but not everyone is going to be saved. And this message of salvation is ONLY for those people who are being saved. It is not for other people. Thank you, Rick C. Hodgin |
ram@zedat.fu-berlin.de (Stefan Ram): Mar 21 05:14PM >Report() { report = std::make_shared<Resource>();} >Report(Resource* a) { report= std::shared_ptr<Resource>(a, [](Resource*){});} The line above allows /dependency injection/. One might check out whether the default constructor could call the parameterized constructor Report() : this( ... . One might check out whether the constructor with one parameter could be declared »explicit«. The hardwiring of a dependency in the default constructor (if I understand the code correctly) is also known as »bastard injection« and might violate the dependency inversion principle. |
joecook@gmail.com: Mar 21 05:16AM -0700 Is there a more well worn idiom for a class that, by default, will own its own resource, but will also be happy to have that resource externally created/managed? For example: #include <memory> class Resource { //stuff }; class Report { public: Report() { report = std::make_shared<Resource>();} Report(Resource* a) { report= std::shared_ptr<Resource>(a, [](Resource*){});} private: std::shared_ptr<Resource> report; }; Class above can use default copy constructor or default assignment operator and the shared ptr should always carry the right deleter here I believe. Can anyone offer improvements here? Is there a more well worn pattern here? JC |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 21 12:17PM +0100 On 21-Mar-17 11:43 AM, Rick C. Hodgin wrote: > Did you mean to post a topic with ",," for the subject? No, it's this combination of Microsoft things: a Microsoft keyboard, and Microsoft Windows. It's all Bill Gates' fault. So. Cheers!, - Alf |
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:
Post a Comment