Skip to content

Commit

Permalink
fixed bugs from pezy#200
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Apr 15, 2015
1 parent 2cb474c commit db52f92
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions ch14/ex14_24.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "date.h"
#include "ex14_24.h"
#include <algorithm>

//! constructor taking Size as days
Expand Down Expand Up @@ -67,7 +67,7 @@ Date::Date(const Date &d) :
{}

//! move constructor
Date::Date(Date&& d) noexcept :
Date::Date(Date&& d) NOEXCEPT :
day(d.day), month(d.month), year(d.year)
{ std::cout << "copy moving";}

Expand All @@ -82,7 +82,7 @@ Date &Date::operator= (const Date &d)
}

//! move operator=
Date &Date::operator =(Date&& rhs) noexcept
Date &Date::operator =(Date&& rhs) NOEXCEPT
{
if(this != &rhs)
{
Expand Down
10 changes: 8 additions & 2 deletions ch14/ex14_24.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
#ifndef DATE_H
#define DATE_H

#ifndef _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif

#include <iostream>
#include <vector>

Expand All @@ -73,12 +79,12 @@ class Date
//! copy constructor
Date(const Date& d);
//! move constructor
Date(Date&& d) noexcept;
Date(Date&& d) NOEXCEPT;

//! copy operator=
Date& operator= (const Date& d);
//! move operator=
Date& operator= (Date&& rhs) noexcept;
Date& operator= (Date&& rhs) NOEXCEPT;

//! destructor -- in this case, user-defined destructor is not nessary.
~Date(){ std::cout << "destroying\n"; }
Expand Down
10 changes: 2 additions & 8 deletions ch14/ex14_24_TEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@
//! Decide whether the class you used in exercise 7.40 from § 7.5.1 (p. 291) needs a
//! copy- and move-assignment operator. If so, define those operators.
//!

#include "ex14_24.h"
#include <iostream>
#include <vector>

#include "Sales_data.h"
#include "date.h"
#include "StrBlob.h"
#include "strvec.h"
#include "string.h"
#include <algorithm>

int main()
{
Expand Down

0 comments on commit db52f92

Please sign in to comment.