adding dynmaic_poitner_cast + fixed includes

This commit is contained in:
Daniel Larimer 2012-09-23 17:20:03 -04:00
parent dc91979409
commit 4e42769366
4 changed files with 17 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#define _FC_DATASTREAM_HPP_
#include <fc/utility.hpp>
#include <fc/exception.hpp>
#include <string.h>
#include <stdint.h>
namespace fc {

View file

@ -4,9 +4,12 @@
#include <fc/datastream.hpp>
#include <fc/varint.hpp>
#include <fc/optional.hpp>
#include <fc/vector.hpp>
//#include <fc/value.hpp>
namespace fc { namespace raw {
namespace fc {
class value;
namespace raw {
template<typename Stream, typename T>
void unpack( Stream& s, fc::optional<T>& v );

View file

@ -26,6 +26,12 @@ namespace fc {
template<typename T>
class shared_ptr {
public:
template<typename Other>
shared_ptr( const shared_ptr<Other>& o )
:_ptr(o.get()) {
if(_ptr) _ptr->retain();
}
shared_ptr( T* t, bool inc = false )
:_ptr(t) { if( inc ) t->retain(); }
@ -70,6 +76,11 @@ namespace fc {
private:
T* _ptr;
};
template<typename T, typename O>
fc::shared_ptr<T> dynamic_pointer_cast( const fc::shared_ptr<O>& t ) {
return fc::shared_ptr<T>( dynamic_cast<T*>(t.get()), true );
}
}
#endif

View file

@ -8,6 +8,7 @@
#ifndef _FC_STATIC_REFLECT_HPP_
#define _FC_STATIC_REFLECT_HPP_
#include <fc/utility.hpp>
#include <boost/static_assert.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/seq/for_each.hpp>