Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » [CDT 9.4] Error on building indexes with Boost libraries 1.46
[CDT 9.4] Error on building indexes with Boost libraries 1.46 [message #1782992] Tue, 06 March 2018 08:27
Yimeng Chu is currently offline Yimeng ChuFriend
Messages: 1
Registered: March 2018
Junior Member
Building the project is OK, but there are errors about invalid arguments to addOperation after Eclipse builds indexes:
https://static.oschina.net/uploads/space/2018/0314/085111_VFFl_3797238.png
in which
 template<class Func, class Service>
        Operation< typename internal::GetSignature<Func>::Signature >&
addOperation( const std::string name, Func func, Service* serv, ExecutionThread et = ClientThread )
 {
     return tcservice->addOperation(name,func, serv, et); //  tcservice is Class Service
 }

In addition, I find that in the function addOperation( const std::string name, Func func, Service* serv, ExecutionThread et = ClientThread ) function func that has arguments is resolved correctly, however, function func that has no arguments must lead to errors on building indexes for addOperation.
relavant codes are as below:

/******************************************************************/
class Service {
public:
template<class Func, class Class>
        Operation< typename internal::GetSignature<Func>::Signature >&
        addOperation( const std::string name, Func func, Class* obj, ExecutionThread et = ClientThread )
        {
            typedef typename internal::GetSignature<Func>::Signature Signature;
            Operation<Signature>* op = new Operation<Signature>(name, func, obj, et, this->getOwnerExecutionEngine() );
            ownedoperations.push_back(op);
            return addOperation( *op );
        }
};


template<class Signature>
    class Operation
    : public base::OperationBase
{
public:
        Operation(const std::string& name, boost::function<Signature> func, ExecutionThread et = ClientThread, ExecutionEngine* ownerEngine = NULL )
        :OperationBase(name)
        {
            this->calls(func, et, ownerEngine);
        }

        template<class Function, class Object>
        Operation& calls(Function func, Object o, ExecutionThread et = ClientThread, ExecutionEngine* ownerEngine = NULL ) {
            // creates a Local OperationCaller or sets function
            ExecutionEngine* null_caller = 0;
            impl = boost::make_shared<internal::LocalOperationCaller<Signature> >(func, o, ownerEngine ? ownerEngine : this->mowner, null_caller, et);
            return *this;
        }
};

 template<class FunctionT>
 struct LocalOperationCaller
            : public Invoker<FunctionT,LocalOperationCallerImpl<FunctionT> >
{
            template<class M, class ObjectType>
            LocalOperationCaller(M meth, ObjectType object, ExecutionEngine* ee, ExecutionEngine* caller, ExecutionThread et = ClientThread)
            {
                this->setCaller( caller );
                this->setOwner(ee );
                this->setThread( et, ee );
                this->mmeth = OperationCallerBinder<Signature>()(meth, object);
            }
};

 template<class F>
 struct OperationCallerBinder
            : public OperationCallerBinderImpl<boost::function_traits<F>::arity, F>
 {};

 template<int, class F>
 struct OperationCallerBinderImpl;

 template<class F>
        struct OperationCallerBinderImpl<0,F>
        {
            template<class M, class O>
            boost::function<F> operator()(M m, O o) {
                return boost::bind( boost::mem_fn(m), o );
            }
        };

 template<class F>
        struct OperationCallerBinderImpl<1,F>
        {
            template<class M, class O>
            boost::function<F> operator()(M m, O o) {
                return boost::bind( boost::mem_fn(m), o, _1 );
            }
        };


/**************************************************/

        template<class FunctionT>
        struct GetSignature {
            typedef typename internal::UnMember< typename boost::remove_pointer<FunctionT>::type >::type Signature;
        };

        template<class F>
        class UnMember
        {
            typedef boost::function_types::components<F> member_signature;
            typedef typename boost::mpl::erase<typename member_signature::types,
                                               typename boost::mpl::next<typename boost::mpl::begin<member_signature>::type>::type>::type non_member_signature;
        public:
            typedef typename boost::function_types::function_type<non_member_signature>::type type;
        };

[Updated on: Wed, 14 March 2018 09:07]

Report message to a moderator

Previous Topic:Resolve path inconsistencies in C++ Indexer
Next Topic:After importing projects to new system: Program file does not exist
Goto Forum:
  


Current Time: Thu Jun 21 22:15:09 GMT 2018

Powered by FUDForum. Page generated in 0.01531 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top