コード例 #1
0
ファイル: sequences.hpp プロジェクト: kylemanna/jsonpack
    static void extract(const jsonpack::value &v, char* json_ptr, std::forward_list<T> &value)
    {
        array_t arr = *v._arr;

        value.clear();

        for(const auto &it : arr)
        {
#ifndef _MSC_VER
            // Initialize before use
            T val = {};
#else
            T val;
#endif  
            if( json_traits<T&>::match_token_type(it) )
            {
                json_traits<T&>::extract(it, json_ptr, val);
                // forward_list not support insert operation
                value.push_front(val);
            }
            else
            {
                throw type_error( "Forward_list item type mismatch" );
            }

        }
    }
コード例 #2
0
ファイル: forward_list.hpp プロジェクト: LancelotGHX/Simula
typename boost::disable_if<
    typename detail::is_default_constructible<
        typename std::forward_list<T, Allocator>::value_type
    >,
    void
>::type
collection_load_impl(
    Archive & ar,
    std::forward_list<T, Allocator> &t,
    collection_size_type count,
    item_version_type item_version
){
    t.clear();
    boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
    ar >> boost::serialization::make_nvp("item", u.reference());
    t.push_front(u.reference());
    typename std::forward_list<T, Allocator>::iterator last;
    last = t.begin();
    ar.reset_object_address(&(*t.begin()) , & u.reference());
    while(--count > 0){
        detail::stack_construct<Archive, T> u(ar, item_version);
        ar >> boost::serialization::make_nvp("item", u.reference());
        last = t.insert_after(last, u.reference());
        ar.reset_object_address(&(*last) , & u.reference());
    }
}
コード例 #3
0
ファイル: forward_list.hpp プロジェクト: imos/icfpc2015
inline void load(
    Archive & ar,
    std::forward_list<U, Allocator> &t,
    const unsigned int file_version
){
    t.clear();
    // retrieve number of elements
    collection_size_type count;
    ar >> BOOST_SERIALIZATION_NVP(count);
    if(collection_size_type(0) == count)
        return;
    item_version_type item_version(0);
    const boost::archive::library_version_type library_version(
        ar.get_library_version()
    );
    if(boost::archive::library_version_type(3) < library_version){
        ar >> BOOST_SERIALIZATION_NVP(item_version);
    }
コード例 #4
0
		void clearDeferred() {
			__EVENTEMITTER_LOCK_GUARD(mutex);
			deferredQueue.clear();
		}
コード例 #5
0
ファイル: signal.hpp プロジェクト: ftk/niceamx
 inline void clear()
 {
   slots.clear();
 }