attribute.cpp 715 字节
Newer Older
L
liuruilong 已提交
1
#include "attribute.h"
朔-望's avatar
朔-望 已提交
2 3

namespace paddle_mobile {
L
liuruilong 已提交
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
namespace framework {



/*
 * Variant<int, float, std::string, std::vector<int>, std::vector<float>,
          std::vector<std::string>, bool, std::vector<bool>, BlockDesc *,
          int64_t>
 * */

struct PrintVistor: Vistor<Print &>{
  PrintVistor(Print &printer):printer_(printer){
  }
  template <typename T>
  Print &operator()(const T &value){
    printer_ << value;
    return printer_;
  }
 private:
  Print &printer_;
};

Print &operator<<(Print &printer, const Attribute &attr) {
  Attribute::ApplyVistor(PrintVistor(printer), attr);
//  std::vector<std::string> v = {"1", "2"};
//  printer << (v);
  return printer;
}

}
朔-望's avatar
朔-望 已提交
34
}  // namespace paddle_mobile