头文件问题
#ifndef busDate_H#define busDate_H
#include <vector>
#include "date.h"
#define DLLEXPORT __declspec(dllexport)
using namespace std;
typedef string HolCtr;
typedef vector<HolCtr> HolCtrs;
enum RollConv {
NO_ROLL, // no roll
ROLL_FWD, // roll forward until business day
ROLL_BACK, // roll backward until business day
MOD_FOLLOW, // while not month-end, roll forward until business day
// otherwise, roll backwise until business day
};
class DLLEXPORT busDate : public date
{
protected:
RollConv roll; // roll convention
HolCtrs holCtrs; // holiday centers
public:
// Constructors
busDate(julianDate jDate = BAD_JDATE, RollConv rc = NO_ROLL, const HolCtrs* pHCs = NULL);
busDate(int year, int month, int day, RollConv rc = NO_ROLL, const HolCtrs* pHCs = NULL);
busDate(const date&, RollConv rc = NO_ROLL, const HolCtrs* pHCs = NULL);
busDate(const busDate&);
// Destructor
virtual ~busDate();
// Assignment
busDate& operator=(const busDate& bDt);
busDate& operator=(const julianDate& jDt);
// Operators
virtual void operator+=(int days);
virtual void operator-=(int days);
busDate& operator++(); // pre-increment
busDate operator++(int); // post-increment
busDate& operator--(); // pre-decrement
busDate operator--(int); // post-decrement
friend DLLEXPORT busDate operator+(const busDate& bDate, int n);
friend DLLEXPORT busDate operator-(const busDate& bDate, int n);
// Basic Operations
virtual void rollBusDate();
virtual void setYMD(int year, int month, int day);
void addDays(int days);
virtual void addMonths(int months);
virtual void addYears(int years);
virtual void setEOM();
virtual bool isMonthEnd() const;
long numBusDays(const busDate& endBD) const;
// Roll convention operations
RollConv getRollConv() const { return roll; }
void setRollConv(RollConv);
// Holiday center operations
void setHolCtrs(const HolCtrs&);
void delHolCtrs();
const HolCtrs& getHolCtrs() const { return holCtrs; }
// Other functions
static bool isBusDay(julianDate jDt, const HolCtrs& hCs);
static bool isMonthEnd(julianDate jDt, const HolCtrs& hCs);
// Static functions to manipulate holidays
static int initHolidays();
static bool isHoliday(julianDate jDt, const HolCtrs& hCs);
static int loadHolidays(const string fileName);
static int addHoliday(const HolCtr hC, julianDate jholiday);
static void clearHolidays();
};
#endif
我有上面的头文件,编译说不成功,好像是因为 我在 typedef string HolCtr; typedef vector<HolCtr> HolCtrs中用了 string;
我在前面加了 using namespace std 后 好像就可以了 ,但是有没有什么办法 不改 头文件, 不加std 解决?