Giter VIP home page Giter VIP logo

discovering_modern_cpp's Introduction

discovering_modern_cpp

Source codes of Discovering Modern C++

discovering_modern_cpp's People

Contributors

petergottschling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discovering_modern_cpp's Issues

advance_test.cpp does not compile after updating to use author's advance implementation

When looking at the Function Dispatching example, shown in 4-1, something looks amiss. I tried typing it in as shown, but was quite suspicious of the advance template. Couldn't get it to work, so i pulled the repo and looked at the advance_test.cpp file in c++11 directory. I compiled it as is (more or less) and it worked ( after changing the iterator up a bit. A forward_list isn't going to support reverse iteration, right?.):

auto it= l.begin();
advance(it, 2);
cout << *it << '\n';

However, after setting #if 0 to #if 1 it ceased to compile. I decided to fix what was bothering me. That last advance template is defined in relation to advance. However, I assume that you meant advance_aux; otherwise, what is the point of defining all the specializations?
So, I change the template function ( or is it function template ? ):

template <typename Iterator, typename Distance>
inline void advance2(Iterator& i, Distance n)
{
    advance_aux(i, n, typename iterator_category<Iterator>::type());

}

But that didn't work. But something was bugging me about the third line.. A little swearing and googling and i came up with this, which works:

template <typename Iterator, typename Distance>
inline void advance2(Iterator& i, Distance n)
{
    advance_aux(i, n, typename  iterator_traits<Iterator>::iterator_category());
}

It is unfortunate that this doesn't work out of the gate. This example code as printed in the book seems flawed, especially considering there is no real description of what is going on at this point. I bought the book despite concerns raised about code quality in some of the reviews and have found it generally great; hopefully this is an outlier, or perhaps i have misunderstood the issue.

Errors in Discovering Modern C++

Hi Peter,

unfortunately I couldn't find a mail address of you anywhere, therefore I'm opening up an issue here:
I've found several typos and small errors in your book and wondered how to report them appropriately.

Provided there will be a second edition some time in the future and or there will be an errata, I will happily report any issues I will find while reading this book.

my_info.hpp is missing

c++11/template_type_deduction.cpp includes ../myinfo.hpp which is missing. P109 in the book.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.