replace tabs

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@452 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2006-01-09 07:27:01 +00:00
parent 3f7449d7bc
commit 5a3972d804
5 changed files with 66 additions and 60 deletions

View file

@ -1350,19 +1350,19 @@ namespace Loki
};
template<class T>
template<class T>
struct BinderFirstBoundTypeStorage;
template<class T>
template<class T>
struct BinderFirstBoundTypeStorage
{
typedef typename TypeTraits<T>::ParameterType RefOrValue;
};
template <typename R, class TList, template <class> class ThreadingModel>
template <typename R, class TList, template <class> class ThreadingModel>
struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> >
{
typedef Functor<R, TList, ThreadingModel> OriginalFunctor;
typedef Functor<R, TList, ThreadingModel> OriginalFunctor;
typedef const typename TypeTraits<OriginalFunctor>::ReferredType RefOrValue;
};
@ -1383,7 +1383,7 @@ namespace Loki
typedef typename Private::BinderFirstTraits<OriginalFunctor>::Impl Base;
typedef typename OriginalFunctor::ResultType ResultType;
typedef typename OriginalFunctor::Parm1 BoundType;
typedef typename OriginalFunctor::Parm1 BoundType;
typedef typename Private::BinderFirstBoundTypeStorage<
typename Private::BinderFirstTraits<OriginalFunctor>
@ -1491,7 +1491,7 @@ namespace Loki
typename Private::BinderFirstTraits<Fctor>::BoundFunctorType
BindFirst(
const Fctor& fun,
typename Fctor::Parm1 bound)
typename Fctor::Parm1 bound)
{
typedef typename Private::BinderFirstTraits<Fctor>::BoundFunctorType
Outgoing;

View file

@ -500,8 +500,8 @@ bool Chunk::IsCorrupt( unsigned char numBlocks, std::size_t blockSize,
bool Chunk::IsBlockAvailable( void * p, unsigned char numBlocks,
std::size_t blockSize ) const
{
(void) numBlocks;
(void) numBlocks;
if ( IsFilled() )
return false;
@ -1220,6 +1220,9 @@ bool SmallObjAllocator::IsCorrupt( void ) const
////////////////////////////////////////////////////////////////////////////////
// $Log$
// Revision 1.25 2006/01/09 07:27:00 syntheticpp
// replace tabs
//
// Revision 1.24 2006/01/07 03:24:10 lfittl
// Removed useless "using namespace Loki;".
//

View file

@ -243,7 +243,7 @@ void heap_debug()
int main()
{
heap_debug();
heap_debug();
reg();
@ -281,14 +281,14 @@ int main()
p= PFactoryFunctorParm::Instance().CreateObject( 1, func2, 64,64 );
delete p;
cout << endl;
cout << "Registered ids: \n";
cout << "Registered ids: \n";
std::vector<std::string> ids = PFactory::Instance().RegisteredIds();
std::vector<std::string> ids = PFactory::Instance().RegisteredIds();
for(std::vector<std::string>::iterator it=ids.begin(); it!=ids.end(); ++it)
cout << *it << "\n";
for(std::vector<std::string>::iterator it=ids.begin(); it!=ids.end(); ++it)
cout << *it << "\n";
cout << endl;
@ -303,6 +303,9 @@ int main()
// $Log$
// Revision 1.13 2006/01/09 07:27:01 syntheticpp
// replace tabs
//
// Revision 1.12 2006/01/05 00:23:43 syntheticpp
// always use #include <loki/...>, Thanks to Lukas Fittl
//

View file

@ -21,38 +21,38 @@
struct UserDatabase
{
void AddFriend(const std::string&, const std::string&)
{
throw 55;
}
void AddFriend(const std::string&, const std::string&)
{
throw 55;
}
};
class User
{
public:
User(UserDatabase* db) : pDB_(db){}
User(UserDatabase* db) : pDB_(db){}
std::string GetName();
std::string GetName();
void AddFriend(User& newFriend);
void AddFriendGuarded(User& newFriend);
void AddFriendGuarded(User& newFriend);
size_t countFriends();
size_t countFriends();
private:
typedef std::vector<User*> UserCont;
typedef std::vector<User*> UserCont;
UserCont friends_;
UserDatabase* pDB_;
};
std::string User::GetName()
{
return "A name";
return "A name";
}
size_t User::countFriends()
{
return friends_.size();
return friends_.size();
}
void User::AddFriend(User& newFriend)
@ -64,7 +64,7 @@ void User::AddFriend(User& newFriend)
void User::AddFriendGuarded(User& newFriend)
{
friends_.push_back(&newFriend);
Loki::ScopeGuard guard = Loki::MakeObjGuard(friends_, &UserCont::pop_back);
Loki::ScopeGuard guard = Loki::MakeObjGuard(friends_, &UserCont::pop_back);
pDB_->AddFriend(GetName(), newFriend.GetName());
guard.Dismiss();
}
@ -72,18 +72,18 @@ void User::AddFriendGuarded(User& newFriend)
int main()
{
UserDatabase db;
UserDatabase db;
User u1(&db);
User u2(&db);
User u1(&db);
User u2(&db);
try{ u1.AddFriend(u2); }
try{ u1.AddFriend(u2); }
catch (...){}
std::cout << "u1 countFriends: " << u1.countFriends() << "\n";
std::cout << "u1 countFriends: " << u1.countFriends() << "\n";
try{ u2.AddFriendGuarded(u1); }
try{ u2.AddFriendGuarded(u1); }
catch (...){}
std::cout << "u2 countFriends: " << u2.countFriends() << "\n";
std::cout << "u2 countFriends: " << u2.countFriends() << "\n";
#if defined(__BORLANDC__) || defined(_MSC_VER)
system("PAUSE");

View file

@ -19,63 +19,63 @@
class Base : public Loki::BaseVisitable<>
{
public:
LOKI_DEFINE_VISITABLE()
LOKI_DEFINE_VISITABLE()
};
class Type1 : public Base
{
public:
LOKI_DEFINE_VISITABLE()
LOKI_DEFINE_VISITABLE()
};
class VariableVisitor :
public Loki::BaseVisitor,
//public Loki::Visitor<Base>,
//public Loki::Visitor<Type1>
public Loki::Visitor<LOKI_TYPELIST_2(Base,Type1)>
//public Loki::Visitor<Loki::Seq<Base,Type1>::Type>
public Loki::BaseVisitor,
//public Loki::Visitor<Base>,
//public Loki::Visitor<Type1>
public Loki::Visitor<LOKI_TYPELIST_2(Base,Type1)>
//public Loki::Visitor<Loki::Seq<Base,Type1>::Type>
{
public:
void Visit(Base&){std::cout << "void Visit(Base&)\n";}
void Visit(Type1&){std::cout << "void Visit(Type1&)\n";}
void Visit(Base&){std::cout << "void Visit(Base&)\n";}
void Visit(Type1&){std::cout << "void Visit(Type1&)\n";}
};
class CBase : public Loki::BaseVisitable<void, Loki::DefaultCatchAll, true>
{
public:
LOKI_DEFINE_CONST_VISITABLE()
LOKI_DEFINE_CONST_VISITABLE()
};
class CType1 : public CBase
{
public:
LOKI_DEFINE_CONST_VISITABLE()
LOKI_DEFINE_CONST_VISITABLE()
};
class CVariableVisitor :
public Loki::BaseVisitor,
//public Loki::Visitor<CBase,void,true>,
//public Loki::Visitor<CType1,void,true>
public Loki::Visitor<LOKI_TYPELIST_2(CBase,CType1),void,true>
//public Loki::Visitor<Loki::Seq<CBase,CType1>::Type,void,true>
public Loki::BaseVisitor,
//public Loki::Visitor<CBase,void,true>,
//public Loki::Visitor<CType1,void,true>
public Loki::Visitor<LOKI_TYPELIST_2(CBase,CType1),void,true>
//public Loki::Visitor<Loki::Seq<CBase,CType1>::Type,void,true>
{
public:
void Visit(const CBase&){std::cout << "void Visit(CBase&)\n";}
void Visit(const CType1&){std::cout << "void Visit(CType1&)\n";}
void Visit(const CBase&){std::cout << "void Visit(CBase&)\n";}
void Visit(const CType1&){std::cout << "void Visit(CType1&)\n";}
};
int main()
{
VariableVisitor visitor;
Type1 type1;
Base* dyn = &type1;
dyn->Accept(visitor);
VariableVisitor visitor;
Type1 type1;
Base* dyn = &type1;
dyn->Accept(visitor);
CVariableVisitor cvisitor;
CType1 ctype1;
CBase* cdyn = &ctype1;
cdyn->Accept(cvisitor);
CVariableVisitor cvisitor;
CType1 ctype1;
CBase* cdyn = &ctype1;
cdyn->Accept(cvisitor);
#if defined(__BORLANDC__) || defined(_MSC_VER)
system("PAUSE");