i2pd-sys 0.0.6

Raw FFI bindings to a minimal C shim over libi2pd (PurpleI2P/i2pd)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
#ifndef BOOST_BIND_BIND_HPP_INCLUDED
#define BOOST_BIND_BIND_HPP_INCLUDED

// MS compatible compilers support #pragma once

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

//
// bind.hpp - binds function objects to arguments
//
// Copyright 2001-2005, 2024 Peter Dimov
// Copyright 2001 David Abrahams
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//  See http://www.boost.org/libs/bind for documentation.
//

#include <boost/bind/mem_fn.hpp>
#include <boost/bind/arg.hpp>
#include <boost/bind/std_placeholders.hpp>
#include <boost/bind/detail/result_traits.hpp>
#include <boost/bind/detail/tuple_for_each.hpp>
#include <boost/bind/detail/integer_sequence.hpp>
#include <boost/visit_each.hpp>
#include <boost/is_placeholder.hpp>
#include <boost/type.hpp>
#include <boost/core/ref.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <utility>
#include <type_traits>
#include <tuple>

#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated
#endif

namespace boost
{

template<class T> class weak_ptr;

namespace _bi // implementation details
{

// ref_compare

template<class T> bool ref_compare( T const & a, T const & b )
{
    return a == b;
}

template<int I> bool ref_compare( arg<I> const &, arg<I> const & )
{
    return true;
}

template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) () )
{
    return true;
}

template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b )
{
    return a.get_pointer() == b.get_pointer();
}

// bind_t forward declaration for listN

template<class R, class F, class L> class bind_t;

template<class R, class F, class L> bool ref_compare( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
{
    return a.compare( b );
}

// value

template<class T> class value
{
public:

    value(T const & t): t_(t) {}

    T & get() { return t_; }
    T const & get() const { return t_; }

    bool operator==(value const & rhs) const
    {
        return t_ == rhs.t_;
    }

private:

    T t_;
};

// ref_compare for weak_ptr

template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b )
{
    return !(a.get() < b.get()) && !(b.get() < a.get());
}

// type

template<class T> class type {};

// unwrap

template<class F> struct unwrapper
{
    static inline F & unwrap( F & f, long )
    {
        return f;
    }

    template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
    {
        return rf.get();
    }

    template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
    {
        return _mfi::dm<R, T>( pm );
    }
};

// list

template<class V> struct accept_lambda
{
    V& v_;

    explicit accept_lambda( V& v ): v_( v ) {}

    template<class A> void operator()( A& a ) const
    {
        visit_each( v_, a, 0 );
    }
};

struct equal_lambda
{
    bool result;

    equal_lambda(): result( true ) {}

    template<class A1, class A2> void operator()( A1& a1, A2& a2 )
    {
        result = result && ref_compare( a1, a2 );
    }
};

struct logical_and;
struct logical_or;

template<class... A> class list
{
private:

    typedef std::tuple<A...> data_type;
    data_type data_;

public:

    list( A... a ): data_( a... ) {}

#if defined(BOOST_MSVC)
# pragma warning( push )
# pragma warning( disable: 4100 ) // unreferenced formal parameter 'a2'
#endif

    template<class R, class F, class A2, std::size_t... I> R call_impl( type<R>, F & f, A2 & a2, _bi::index_sequence<I...> )
    {
        return unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
    }

    template<class R, class F, class A2, std::size_t... I> R call_impl( type<R>, F & f, A2 & a2, _bi::index_sequence<I...> ) const
    {
        return unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
    }

    template<class F, class A2, std::size_t... I> void call_impl( type<void>, F & f, A2 & a2, _bi::index_sequence<I...> )
    {
        unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
    }

    template<class F, class A2, std::size_t... I> void call_impl( type<void>, F & f, A2 & a2, _bi::index_sequence<I...> ) const
    {
        unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
    }

#if defined(BOOST_MSVC)
# pragma warning( pop )
#endif

    //

    template<class R, class F, class A2> R operator()( type<R>, F & f, A2 & a2 )
    {
        return call_impl( type<R>(), f, a2, _bi::index_sequence_for<A...>() );
    }

    template<class R, class F, class A2> R operator()( type<R>, F & f, A2 & a2 ) const
    {
        return call_impl( type<R>(), f, a2, _bi::index_sequence_for<A...>() );
    }

    //

    template<class A2> bool operator()( type<bool>, logical_and & /*f*/, A2 & a2 )
    {
        static_assert( sizeof...(A) == 2, "operator&& must have two arguments" );
        return a2[ std::get<0>( data_ ) ] && a2[ std::get<1>( data_ ) ];
    }

    template<class A2> bool operator()( type<bool>, logical_and const & /*f*/, A2 & a2 ) const
    {
        static_assert( sizeof...(A) == 2, "operator&& must have two arguments" );
        return a2[ std::get<0>( data_ ) ] && a2[ std::get<1>( data_ ) ];
    }

    template<class A2> bool operator()( type<bool>, logical_or & /*f*/, A2 & a2 )
    {
        static_assert( sizeof...(A) == 2, "operator|| must have two arguments" );
        return a2[ std::get<0>( data_ ) ] || a2[ std::get<1>( data_ ) ];
    }

    template<class A2> bool operator()( type<bool>, logical_or const & /*f*/, A2 & a2 ) const
    {
        static_assert( sizeof...(A) == 2, "operator|| must have two arguments" );
        return a2[ std::get<0>( data_ ) ] || a2[ std::get<1>( data_ ) ];
    }

    //

    template<class V> void accept( V & v ) const
    {
        _bi::tuple_for_each( accept_lambda<V>( v ), data_ );
    }

    bool operator==( list const & rhs ) const
    {
        return _bi::tuple_for_each( equal_lambda(), data_, rhs.data_ ).result;
    }
};

// bind_t

template<class... A> class rrlist
{
private:

    using args_type = std::tuple<A...>;

    using data_type = std::tuple<A&...>;
    data_type data_;

    template<class...> friend class rrlist;

public:

    explicit rrlist( A&... a ): data_( a... ) {}
    template<class... B> explicit rrlist( rrlist<B...> const& r ): data_( r.data_ ) {}

    template<int I> typename std::tuple_element<I-1, args_type>::type&& operator[] ( boost::arg<I> ) const
    {
        return std::forward<typename std::tuple_element<I-1, args_type>::type>( std::get<I-1>( data_ ) );
    }

    template<int I> typename std::tuple_element<I-1, args_type>::type&& operator[] ( boost::arg<I>(*)() ) const
    {
        return std::forward<typename std::tuple_element<I-1, args_type>::type>( std::get<I-1>( data_ ) );
    }

    template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }

    template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }

    template<class T> T & operator[] ( reference_wrapper<T> const & v ) const { return v.get(); }

    template<class R, class F, class L> typename result_traits<R, F>::type operator[] ( bind_t<R, F, L> & b ) const
    {
        rrlist<A&...> a2( *this );
        return b.eval( a2 );
    }

    template<class R, class F, class L> typename result_traits<R, F>::type operator[] ( bind_t<R, F, L> const & b ) const
    {
        rrlist<A&...> a2( *this );
        return b.eval( a2 );
    }
};

template<class R, class F, class L> class bind_t
{
private:

    F f_;
    L l_;

public:

    typedef typename result_traits<R, F>::type result_type;
    typedef bind_t this_type;

    bind_t( F f, L const & l ): f_( std::move(f) ), l_( l ) {}

    //

    template<class... A> result_type operator()( A&&... a )
    {
        rrlist<A...> a2( a... );
        return l_( type<result_type>(), f_, a2 );
    }

    template<class... A> result_type operator()( A&&... a ) const
    {
        rrlist<A...> a2( a... );
        return l_( type<result_type>(), f_, a2 );
    }

    //

    template<class A> result_type eval( A & a )
    {
        return l_( type<result_type>(), f_, a );
    }

    template<class A> result_type eval( A & a ) const
    {
        return l_( type<result_type>(), f_, a );
    }

    template<class V> void accept( V & v ) const
    {
        using boost::visit_each;
        visit_each( v, f_, 0 );
        l_.accept( v );
    }

    bool compare( this_type const & rhs ) const
    {
        return ref_compare( f_, rhs.f_ ) && l_ == rhs.l_;
    }
};

// function_equal

template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
{
    return a.compare(b);
}

// add_value

template< class T, int I > struct add_value_2
{
    typedef boost::arg<I> type;
};

template< class T > struct add_value_2< T, 0 >
{
    typedef _bi::value< T > type;
};

template<class T> struct add_value
{
    typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
};

template<class T> struct add_value< value<T> >
{
    typedef _bi::value<T> type;
};

template<class T> struct add_value< reference_wrapper<T> >
{
    typedef reference_wrapper<T> type;
};

template<int I> struct add_value< arg<I> >
{
    typedef boost::arg<I> type;
};

template<int I> struct add_value< arg<I> (*) () >
{
    typedef boost::arg<I> (*type) ();
};

template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
{
    typedef bind_t<R, F, L> type;
};

// list_av

template<class... A> struct list_av
{
    typedef list< typename add_value<A>::type... > type;
};

// operator!

struct logical_not
{
    template<class V> bool operator()(V const & v) const { return !v; }
};

template<class R, class F, class L>
    bind_t< bool, logical_not, list< bind_t<R, F, L> > >
    operator! (bind_t<R, F, L> const & f)
{
    typedef list< bind_t<R, F, L> > list_type;
    return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
}

// relational operators

#define BOOST_BIND_OPERATOR( op, name ) \
\
struct name \
{ \
    template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
}; \
 \
template<class R, class F, class L, class A2> \
    bind_t< bool, name, list< bind_t<R, F, L>, typename add_value<A2>::type > > \
    operator op (bind_t<R, F, L> const & f, A2 a2) \
{ \
    typedef typename add_value<A2>::type B2; \
    typedef list< bind_t<R, F, L>, B2> list_type; \
    return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
}

BOOST_BIND_OPERATOR( ==, equal )
BOOST_BIND_OPERATOR( !=, not_equal )

BOOST_BIND_OPERATOR( <, less )
BOOST_BIND_OPERATOR( <=, less_equal )

BOOST_BIND_OPERATOR( >, greater )
BOOST_BIND_OPERATOR( >=, greater_equal )

BOOST_BIND_OPERATOR( &&, logical_and )
BOOST_BIND_OPERATOR( ||, logical_or )

#undef BOOST_BIND_OPERATOR

// visit_each

template<class V, class T> void visit_each( V & v, value<T> const & t, int )
{
    using boost::visit_each;
    visit_each( v, t.get(), 0 );
}

template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
{
    t.accept( v );
}

} // namespace _bi

// is_bind_expression

template< class T > struct is_bind_expression
{
    enum _vt { value = 0 };
};

template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
{
    enum _vt { value = 1 };
};

// bind

#ifndef BOOST_BIND
#define BOOST_BIND bind
#endif

// generic function objects

#if !BOOST_WORKAROUND(__GNUC__, < 6)

template<class R, class F, class... A>
    _bi::bind_t<R, F, typename _bi::list_av<A...>::type>
    BOOST_BIND( F f, A... a )
{
    typedef typename _bi::list_av<A...>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a... ) );
}

#else

// g++ 4.x (and some 5.x) consider boost::bind<void>( &X::f )
// ambiguous if the variadic form above is used

template<class R, class F>
    _bi::bind_t<R, F, typename _bi::list_av<>::type>
    BOOST_BIND( F f )
{
    typedef typename _bi::list_av<>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type() );
}

template<class R, class F, class A1>
    _bi::bind_t<R, F, typename _bi::list_av<A1>::type>
    BOOST_BIND( F f, A1 a1 )
{
    typedef typename _bi::list_av<A1>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1 ) );
}

template<class R, class F, class A1, class A2>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2>::type>
    BOOST_BIND( F f, A1 a1, A2 a2 )
{
    typedef typename _bi::list_av<A1, A2>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2 ) );
}

template<class R, class F, class A1, class A2, class A3>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3 )
{
    typedef typename _bi::list_av<A1, A2, A3>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3 ) );
}

template<class R, class F, class A1, class A2, class A3, class A4>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4 )
{
    typedef typename _bi::list_av<A1, A2, A3, A4>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4 ) );
}

template<class R, class F, class A1, class A2, class A3, class A4, class A5>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 )
{
    typedef typename _bi::list_av<A1, A2, A3, A4, A5>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5 ) );
}

template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 )
{
    typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6 ) );
}

template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 )
{
    typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6, a7 ) );
}

template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 )
{
    typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6, a7, a8 ) );
}

template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
    _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
    BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 )
{
    typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) );
}

#endif

// generic function objects, alternative syntax

template<class R, class F, class... A>
    _bi::bind_t<R, F, typename _bi::list_av<A...>::type>
    BOOST_BIND( boost::type<R>, F f, A... a )
{
    typedef typename _bi::list_av<A...>::type list_type;
    return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a... ) );
}

// adaptable function objects

template<class F, class... A>
    _bi::bind_t<_bi::unspecified, F, typename _bi::list_av<A...>::type>
    BOOST_BIND( F f, A... a )
{
    typedef typename _bi::list_av<A...>::type list_type;
    return _bi::bind_t<_bi::unspecified, F, list_type>( std::move(f), list_type( a... ) );
}

// function pointers

#define BOOST_BIND_CC
#define BOOST_BIND_ST
#define BOOST_BIND_NOEXCEPT

#include <boost/bind/detail/bind_cc.hpp>

# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
#   undef BOOST_BIND_NOEXCEPT
#   define BOOST_BIND_NOEXCEPT noexcept
#   include <boost/bind/detail/bind_cc.hpp>
# endif

#undef BOOST_BIND_CC
#undef BOOST_BIND_ST
#undef BOOST_BIND_NOEXCEPT

#if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64)

#define BOOST_BIND_CC __stdcall
#define BOOST_BIND_ST
#define BOOST_BIND_NOEXCEPT

#include <boost/bind/detail/bind_cc.hpp>

#undef BOOST_BIND_CC
#undef BOOST_BIND_ST
#undef BOOST_BIND_NOEXCEPT

#endif

#if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64)

#define BOOST_BIND_CC __fastcall
#define BOOST_BIND_ST
#define BOOST_BIND_NOEXCEPT

#include <boost/bind/detail/bind_cc.hpp>

#undef BOOST_BIND_CC
#undef BOOST_BIND_ST
#undef BOOST_BIND_NOEXCEPT

#endif

#ifdef BOOST_BIND_ENABLE_PASCAL

#define BOOST_BIND_ST pascal
#define BOOST_BIND_CC
#define BOOST_BIND_NOEXCEPT

#include <boost/bind/detail/bind_cc.hpp>

#undef BOOST_BIND_ST
#undef BOOST_BIND_CC
#undef BOOST_BIND_NOEXCEPT

#endif

// member function pointers

#define BOOST_BIND_MF_NAME(X) X
#define BOOST_BIND_MF_CC
#define BOOST_BIND_MF_NOEXCEPT

#include <boost/bind/detail/bind_mf_cc.hpp>
#include <boost/bind/detail/bind_mf2_cc.hpp>

# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
#   undef BOOST_BIND_MF_NOEXCEPT
#   define BOOST_BIND_MF_NOEXCEPT noexcept
#   include <boost/bind/detail/bind_mf_cc.hpp>
#   include <boost/bind/detail/bind_mf2_cc.hpp>
# endif

#undef BOOST_BIND_MF_NAME
#undef BOOST_BIND_MF_CC
#undef BOOST_BIND_MF_NOEXCEPT

#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)

#define BOOST_BIND_MF_NAME(X) X##_cdecl
#define BOOST_BIND_MF_CC __cdecl
#define BOOST_BIND_MF_NOEXCEPT

#include <boost/bind/detail/bind_mf_cc.hpp>
#include <boost/bind/detail/bind_mf2_cc.hpp>

#undef BOOST_BIND_MF_NAME
#undef BOOST_BIND_MF_CC
#undef BOOST_BIND_MF_NOEXCEPT

#endif

#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)

#define BOOST_BIND_MF_NAME(X) X##_stdcall
#define BOOST_BIND_MF_CC __stdcall
#define BOOST_BIND_MF_NOEXCEPT

#include <boost/bind/detail/bind_mf_cc.hpp>
#include <boost/bind/detail/bind_mf2_cc.hpp>

#undef BOOST_BIND_MF_NAME
#undef BOOST_BIND_MF_CC
#undef BOOST_BIND_MF_NOEXCEPT

#endif

#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)

#define BOOST_BIND_MF_NAME(X) X##_fastcall
#define BOOST_BIND_MF_CC __fastcall
#define BOOST_BIND_MF_NOEXCEPT

#include <boost/bind/detail/bind_mf_cc.hpp>
#include <boost/bind/detail/bind_mf2_cc.hpp>

#undef BOOST_BIND_MF_NAME
#undef BOOST_BIND_MF_CC
#undef BOOST_BIND_MF_NOEXCEPT

#endif

// data member pointers

namespace _bi
{

template<class M, int I> struct add_cref;

template<class M> struct add_cref<M, 0>
{
    typedef M type;
};

template<class M> struct add_cref<M, 1>
{
    typedef M const& type;
};

template<class R> struct isref
{
    enum value_type { value = 0 };
};

template<class R> struct isref< R& >
{
    enum value_type { value = 1 };
};

template<class R> struct isref< R* >
{
    enum value_type { value = 1 };
};

template<class M, class A1, bool fn = std::is_function<M>::value> struct dm_result
{
};

template<class M, class A1> struct dm_result<M, A1, false>
{
    typedef typename add_cref< M, 1 >::type type;
};

template<class M, class R, class F, class L> struct dm_result<M, bind_t<R, F, L>, false>
{
    typedef typename bind_t<R, F, L>::result_type result_type;
    typedef typename add_cref< M, isref< result_type >::value >::type type;
};

} // namespace _bi

template<class A1, class M, class T>

_bi::bind_t<
    typename _bi::dm_result<M, A1>::type,
    _mfi::dm<M, T>,
    typename _bi::list_av<A1>::type
>

BOOST_BIND( M T::*f, A1 a1 )
{
    typedef typename _bi::dm_result<M, A1>::type result_type;
    typedef _mfi::dm<M, T> F;
    typedef typename _bi::list_av<A1>::type list_type;
    return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
}

} // namespace boost

#ifndef BOOST_BIND_NO_PLACEHOLDERS

# include <boost/bind/placeholders.hpp>

#endif

#ifdef BOOST_MSVC
# pragma warning(default: 4512) // assignment operator could not be generated
# pragma warning(pop)
#endif

#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED