Boost logo

Boost :

Subject: Re: [boost] GSOC 2015 : Project on Concurrent Hash Tables
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-03-10 21:48:07


On 11 Mar 2015 at 7:02, Amarnath V A wrote:

> > Regarding the move constructor, I am surprised you haven't noticed it
> > can be written in two lines yet. It wouldn't be particularly
> > efficient, but then I didn't ask for the most efficient solution - I
> > asked for a solution which works and is correct. This programming
> > competency test is actually much smaller than it looks as soon as you
> > mentally grok it, and remember that correctness is far more important
> > than efficiency.
>
> Niall, I was pretty confused about the move constructor. Sorry that I
> could not achieve what is expected.
>
> Are these the approaches or is there a better way to get this done.
> Once again, I apologize if I couldn't meet the expectations of boost
> community out of a prospective GSoC student.

You're not doing too badly in fact. But in common with most students
who get rewarded for the *volume* of code you write for coursework,
you're thinking you need to write the implementation yourself to get
maximum points instead of reusing existing functionality.
Professional programmers shouldn't be judged by lines of code written
(sadly, often they are), but by how bug free and maintainable their
solution to a problem is (sadly many managers and employers don't
understand how to correctly judge this). Usually, but not always,
reusing already tested and debugged preexisting parts to build a
solution is a superior approach to writing anything yourself.

The move constructor can be written in two lines I believe. Think in
terms of what other functions already present could be called to
implement the move constructor for you. You should find the move
constructor becomes quite trivial to implement, maybe two calls into
other routines.

I don't believe the copy constructor is as easy though. That you will
have to implement yourself.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk